Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Saving javascripts externally
Old 03-02-2004, 05:33 PM Saving javascripts externally
wicko3's Avatar
The Wickmeister

Posts: 368
Location: Derby, UK
Trades: 0
Hi

I have read that it is possible to save your javascripts externally as .js files. Does this apply to all javascripts, and should you include the html comment lines, e.g.
Code:
<script language="Javascript">
<!--Begin
...
//End-->
</script>
I realise I don't include the <script> lines, but do you include the <!-- and //--> lines in your .js file?

And can you just save them using Notepad?

Thanx guys!

John
wicko3 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-02-2004, 05:47 PM
Experienced Talker

Posts: 31
Location: Worchester, MA
Trades: 0
Yes, you can link to external javascript:

<script type="text/javascript" src="ScriptFile.js"></script>

No, you do not need comments - if the browser does not support scripting it won't recognize the <SCRIPT> tag, therefore the external script will not be loaded.

In your external JavaScript file you just begin your functions, variables, etc - no other information is needed (i.e. <SCRIPT> tags, comments, etc).

You can create this script in NotePad - just as you would if you were creating JS inline....
__________________

Please login or register to view this content. Registration is FREE
JoeGoldberg is offline
Reply With Quote
View Public Profile
 
Old 03-02-2004, 07:08 PM
dbzguy's Avatar
Ultra Talker

Posts: 345
Location: Artic
Trades: 0
but dont include the html tags in the js file
__________________

Please login or register to view this content. Registration is FREE


PHP Code:
<?PHP if(ping == true) { attackuserip(); } ?>
dbzguy is offline
Reply With Quote
View Public Profile
 
Old 03-04-2004, 03:11 AM
Average Talker

Posts: 15
Location: Arkansas
Trades: 0
Sweet - I was just looking into this and could not find an answer. I knew we could 'point' to a .CSS file...but wasn't sure about .JS

Many Thanks!

As usual - this board saves me alot of time and trouble.
__________________
"I'll be nicer when people get smarter"
Xx MOTU xX is offline
Reply With Quote
View Public Profile
 
Old 03-04-2004, 06:29 AM
Wenslock's Avatar
Webmaster Talker

Posts: 746
Location: Lincoln, UK
Trades: 0
yeah. I'm actually teaching someone in France how to link to both Javascript and CSS files. It's a little hard as there's a large language gap! :-D I think he's getting the gist of it though.

Anything can be done in notepad really. It's just a matter of finding out how!
__________________
------------------------------------------------------------

Please login or register to view this content. Registration is FREE
- Black Prism professional web design services
------------------------------------------------------------
Wenslock is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Saving javascripts externally
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.68833 seconds with 12 queries