Sunday, May 17, 2009

[JavaScript] Re: linking a web page to an external javascript file

> Re: linking a web page to an external javascript file
> Posted by: "David Smart" smartware.consulting@gmail.com smartware_consulting
> Date: Sat May 16, 2009 11:07 pm ((PDT))
>
> Your file should start with your first JavaScript line - i.e. the "function"
> line, and end with the last }.
>
> You should not have a <script> tag in it.
>
> Additionally, <!-- is how you would introduce a comment. I.e. you've
> commented-out all of your script.

Actually, no you haven't. :)

Put the following in a .js file

var msg = 'Hello!';

<!--
msg = 'Good-bye!';
-->

alert msg;

FF2 (on Linux) and Konqeror pop up a dialogue box with the message
"Good-bye!".

Opera (Linux) and MSIE fail with a syntax error.

cheers

jon.

--
This message has not been scanned for viruses.

Since I do not use a Microsoft operating
system or software, and use only plaintext
for email, there is little need for me to do so.


------------------------------------

Visit http://aiaiai.com for more groups to joinYahoo! Groups Links

<*> To reply to this message, go to:
http://groups.yahoo.com/group/JavaScript_Official/post?act=reply&messageNum=16681
Please do not reply to this message via email. More information here:
http://help.yahoo.com/help/us/groups/messages/messages-23.html

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/JavaScript_Official/join
(Yahoo! ID required)

<*> To change settings via email:
mailto:JavaScript_Official-digest@yahoogroups.com
mailto:JavaScript_Official-fullfeatured@yahoogroups.com

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/JavaScript_Official/

<*> To unsubscribe from this group, send an email to:
JavaScript_Official-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

0 comments: