Forum Moderators: open

Message Too Old, No Replies

Javascript, hiding code

         

Blelisa

6:50 pm on May 17, 2006 (gmt 0)

10+ Year Member



Hello all,

I am writing a page with some javacript for navagation buttons and was wondering if you can pull the javascript out of the header and put it in another file and than call that file like you can .css?

Thanks in advance for your help
Lisa

ExecWrkn

8:07 pm on May 17, 2006 (gmt 0)

10+ Year Member



Yes you can, via an external javascript src file

in the <head> section of your <html>

<script type="text/javascript" src="/path/to/your/sourcefile.js"/>

jshanman

12:36 pm on May 18, 2006 (gmt 0)

10+ Year Member



Yes you can, via an external javascript src file

in the <head> section of your <html>

<script type="text/javascript" src="/path/to/your/sourcefile.js"/>


It is also valid to have a script element in the body of your HTML as well as the head.

- JS

Key_Master

12:37 pm on May 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Don't forget the </script> part. :)