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
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. . .
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