external javascript

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Dec 2005
Posts: 9
Reputation: Glynis is an unknown quantity at this point 
Solved Threads: 0
Glynis's Avatar
Glynis Glynis is offline Offline
Newbie Poster

external javascript

 
0
  #1
Dec 7th, 2005
I haven't learned how to do my own javascript but I have some snips from the HTML editor I use (1Page). I'll like to insert some of them into my pages (which I know how to do) but as an external linked file. Is there an easy way to do this like the CSS is?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: external javascript

 
0
  #2
Dec 7th, 2005
Save your script in a file with a ".js" extension, for example, "myExternal.js" Do NOT put <script> tags in the file. In your HTML, you reference the file:

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <SCRIPT language="JavaScript" SRC="myExternal.js"></SCRIPT>
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 9
Reputation: Glynis is an unknown quantity at this point 
Solved Threads: 0
Glynis's Avatar
Glynis Glynis is offline Offline
Newbie Poster

Re: external javascript

 
0
  #3
Dec 7th, 2005
Originally Posted by tgreer
Save your script in a file with a ".js" extension, for example, "myExternal.js" Do NOT put <script> tags in the file. In your HTML, you reference the file:

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <SCRIPT language="JavaScript" SRC="myExternal.js"></SCRIPT>
Don't you also need to put in 'type="text/javascript"'?
Actually, my problem isn't in the html document. I don't have a clue as to how to format the javascript file. Is it done like the external CSS?

Also, I read that FireFox doesn't recognize external js. What I was reading though was written in October and FireFox has updated twice since then. Do you know anything about this?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: external javascript

 
0
  #4
Dec 8th, 2005
Whether or not you need "type=" depends on which doctype/HTML version you're using. Firefox parses external JavaScript just fine, and always has. What do you mean by "format" when you say you don't know how to format the JavaScript file? It's a file that contains JavaScript, pure and simple.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 9
Reputation: Glynis is an unknown quantity at this point 
Solved Threads: 0
Glynis's Avatar
Glynis Glynis is offline Offline
Newbie Poster

Re: external javascript

 
0
  #5
Dec 10th, 2005
I guess what I'm asking is this . . .

Will it work it I put more than one script into an external file the why I put several styles into an enternal css file?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: external javascript

 
0
  #6
Dec 11th, 2005
Any collection of JavaScript variables, functions, and objects can be called a "script". Yes, you can put them all into the same file.

At this point I think you have enough information to experiment. I think you'll be able to answer most of your own questions by trying it out. If not, let us know!
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 9
Reputation: Glynis is an unknown quantity at this point 
Solved Threads: 0
Glynis's Avatar
Glynis Glynis is offline Offline
Newbie Poster

Re: external javascript

 
0
  #7
Dec 12th, 2005
Originally Posted by tgreer
Any collection of JavaScript variables, functions, and objects can be called a "script". Yes, you can put them all into the same file.

At this point I think you have enough information to experiment. I think you'll be able to answer most of your own questions by trying it out. If not, let us know!
Yes, I have enough info. now. I know I've been a bother but with my physical disability, any way to avoid mistakes which will result in more time trying to correct them I do. It saves me from a lot of frustration.

Thank you tgreer.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: external javascript

 
0
  #8
Dec 12th, 2005
You've been no bother at all, you've used the forum for exactly the reason it's here: to ask questions and get enough info to tackle problems. I was just, perhaps tactlessly, encouraging you to learn via experimentation. In my experience, that's the best way to learn!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC