SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2001
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi I would like to put my javascript programs into a seperate file. How do I do that?

    Thanks!

  2. #2
    Irritability Defined
    Join Date
    Jul 2000
    Location
    80,000 feet below the surface
    Posts
    1,442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very simple. Say you have a script like....

    <script language="JavaScript">
    var array=("...,...,...,...,")
    function bc()

    blah blah blah etc.

    </script>

    Copy everything between the two script tags and leave the <script language="JavaScript"> and </script> out. Paste everything into a new file on Notepad, and save it as a .js file e.g. test.js.

    To call the JavaScript, simply do the following :

    <script language="JavaScript" src="test.js"></script>
    My 2 Cents (or is that 2.2 Cents including GST?)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •