It works for me in IE6 exactly as it is. I've just a added a link to execute the function.
Note that
you should use <script language="JavaScript"> for HTML 3.2 and <script type="text/javascript"> in HTML 4 and XHTML. The language attribute is deprecated in HTML 4. The default scripting language in Internet Explorer is JScript, which is very similar to JavaScript, but not the same.
Jules