Bad Credit Mortgages - Credit Cards - Credit Cards - Libros medicina - Free Ringtones

PDA

View Full Version : Is this a silly question?


oo7ml
Feb 6th 2008, 1:00 pm
I have just noticed that alot of my pages have chunks of javascript all over them.

Can i cut this JS and save it as an external file.js

then put

<script language="JavaScript" type="text/javascript" src="js/file.js"></script>

in the <head> of each page


It seems to work but is it ok to do this?

Sorry if this seems a very silly question? thanks in advance

ToddMicheau
Feb 6th 2008, 1:10 pm
If everything is executing fine then putting your javascript in an external file is perfectly alright. You might even be able to combine all your files into one file to save on html code. Really the only reason for doing this is to tidy up your html code, at least in my opinion, that and it's alot easier to edit if a function starts going all funny shaped- no need to scroll through all the html to find the block of javascript that is messing up. . .

oo7ml
Feb 6th 2008, 1:22 pm
Ok cool, thanks, yeah it alot cleaner this way, thanks

WebHostingNerds.com
Feb 6th 2008, 2:55 pm
you can do it with the part of javascript where you define functions etc so you'll just have javascript calls in your HTML code