954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

external javascript

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?

Glynis
Newbie Poster
9 posts since Dec 2005
Reputation Points: 10
Solved Threads: 0
 

Save your script in a file with a ".js" extension, for example, "myExternal.js" Do NOT put

tgreer
Made Her Cry
Team Colleague
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
 
Save your script in a file with a ".js" extension, for example, "myExternal.js" Do NOT put



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?

Glynis
Newbie Poster
9 posts since Dec 2005
Reputation Points: 10
Solved Threads: 0
 

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.

tgreer
Made Her Cry
Team Colleague
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
 

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?

Glynis
Newbie Poster
9 posts since Dec 2005
Reputation Points: 10
Solved Threads: 0
 

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!

tgreer
Made Her Cry
Team Colleague
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
 
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.:)

Glynis
Newbie Poster
9 posts since Dec 2005
Reputation Points: 10
Solved Threads: 0
 

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!

tgreer
Made Her Cry
Team Colleague
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You