No, in HTML, to comment something out and have it not evaluated by the
browser, you do <!-- COMMENT -->.

So, a little thing that alot of javascript developers do to hide the
javascript from older browers (ones that dont support javascript at all,
like cell phone browsers), and make it so that the browser doesnt just
display the javascript on the page, is use HTML comments inside of the
script, like this:

<script>
//<!--
script here
//-->
</script>

And i think the problem the starter of this thread is having is that the
first <!-- isnt commented out, so it causes a syntax error.
On 5/27/07, Ⓙⓐⓚⓔ <[EMAIL PROTECTED]> wrote:

The older browsers that jQuery doesn't support?

On 5/27/07, Matt Stith <[EMAIL PROTECTED]> wrote:
>
> The HTML comments are to hide the script from older browsers that dont
> understand javascript.
>
> On 5/27/07, Ⓙⓐⓚⓔ < [EMAIL PROTECTED]> wrote:
> >
> > why do you have <!-- comments --> instead of /* comments */ in a
> > script?
> >
> > On 5/27/07, Network Newbie <[EMAIL PROTECTED] > wrote:
> > >
> > >
> > > When the function 'globalEval' is evaluating script source that
> > > contains html comments (i.e. <!--), it will get 'syntax error'. html
> > > comments should be stripped before execution.
> > >
> > > Example:
> > > -script source
> > > <script language=javascript>
> > > <!--
> > >         //alert(typeof WebControls.registerListControl);
> > >         alert(3);
> > > //-->
> > > </script>
> > >
> > > --modifled globalEval function that fixes the issue
> > >
> > >         globalEval: function( data ) {
> > >                 if ( window.execScript )
> > >                         window.execScript( 
data.replace(/^\s*\<\!--.*$\n/gm,"")
> > > );
> > >                 else if ( jQuery.browser.safari )
> > >                         // safari doesn't provide a synchronous
> > > global eval
> > >                         window.setTimeout( data, 0 );
> > >                 else
> > >                         eval.call( window, data );
> > >         }
> > >
> > >
> >
> >
> > --
> > Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
>
>
>


--
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ

Reply via email to