vozzek Posted June 20, 2008 Share Posted June 20, 2008 Hi all, Quick question: The pages on my website are based upon the php inclusion of header and footer templates. Both the <head> and </head> tags exist within the header template. Between them, the following code: <SCRIPT LANGUAGE="JavaScript" SRC="/java.js"></SCRIPT> So my java.js file contains JS functions common to all pages. Now I'm on a page where I need to add a JS function, but I only need it for this one page. I need it to go between the <head> </head> tags. Obviously I don't want to add it to the java.js file and have it show up site-wide. So what do I do? Where would I place this function to keep it specific to that one page? The function itself just validates some drop-down info before allowing a form to file. Thanks in advance! Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 20, 2008 Share Posted June 20, 2008 <SCRIPT LANGUAGE="JavaScript" SRC="/java.js"></SCRIPT> <SCRIPT LANGUAGE="JavaScript"> function validate ( ) { // validate code here } </SCRIPT> Quote Link to comment Share on other sites More sharing options...
vozzek Posted June 20, 2008 Author Share Posted June 20, 2008 Can I do that in the <body> section? From what I understood about that type of JS function, it needed to be within the <head></head> tags. Thanks. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 20, 2008 Share Posted June 20, 2008 it's recommended to keep the JS in the head, but you can have JS in the body. Quote Link to comment Share on other sites More sharing options...
vozzek Posted June 20, 2008 Author Share Posted June 20, 2008 Breakin' the RULEZ!!! I like it! Thanks again Rhodesa. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.