You have to take care when posting such scripts as it is entirely possible that avast might just detect it as the real deal. e.g. JS:Packer-?
I had this problem before when posting the javascript code that was causing an alert on it even when wrapped in the BBC Code tags, I tried all sorts to stop avast alerting broken lines, etc., but nothing worked I had to remove it completely.
So when giving an example something I didn't think of at the time, breaking the script over two sets of code tags in the forums so it didn't alert, then or possibly in the future when some innocent visits this or other similar topic