[thelist] xmtml and internal javascript

Ben Dyer ben_dyer at imaginuity.com
Mon Aug 26 13:25:01 CDT 2002


Well, the two goals for doing this, I assume, are for XHTML validation and
to use the old comment trick to hide the code from older browsers.

In a script tag, the goal is to have the script itself surrounded by HTML
comments which prevents older browsers from simply displaying the code in
the script tag.  Under that definition, the second one wouldn't work.  An
older browser would probably still display the text "<!]]>", thus defeating
the purpose.

I've tested the first one in older browsers before and I know it works, so
I would go with that one.

--Ben

At 02:15 PM 8/25/2002, you wrote:
>Which way is best?
>Both validate and both work.
>
><script type="text/javascript">
><!-- <![CDATA[
>         function theFunction(){}
>//]]> -->
></script>
>
>
><script type="text/javascript">
><!--//--><![CDATA[//><!--
>         function theFunction(){}
>//--><!]]>
></script>

Ben Dyer, Senior Internet Developer, Imaginuity Interactive
http://www.imaginuity.com/

Not an Emergency: "AudioGalaxy doesn't work anymore."
Emergency: "The server is on fire, bring the extinguisher!"
Please adjust your e-mail priorities accordingly.
------------------------------------------------------------------------
         http://www.radicalbender.com/     http://www.evolt.org/




More information about the thelist mailing list