PDA

View Full Version : DHTML Code on another page?


Patrick M
10-31-2007, 11:41 PM
In PHP we can do includes to make the page clean, how do we do this on java script? javascript is making my code really messy is there a way for me to write the code on another clean html sheet then call include it on the main page where i want it to be included?

joyaz711
10-31-2007, 11:42 PM
Yep, and it's a good idea so that the spiders don't have to read through all your javascript code anyway.

What you want is an external javascript. Here's some info -

http://www.htmlgoodies.com/beyond/javascript/article.php/3470901

Joyce
http://www.DesignByJoyce.com/

Tomu
10-31-2007, 11:42 PM
lol of course u can .

just save your code in a separate file with .js extension and put it in the same folder as ur html page.
then put this in the html code :
<script language="JavaScript" src="./ur_code.js"></script>

easy as pie