How to create a js from a script?

Discussion in 'JavaScript' started by fryman, Oct 15, 2005.

  1. #1
    I have a script on my page that looks similar to this

    How can I turn this into an external js file? Is there some site out there that has this service?
     
    fryman, Oct 15, 2005 IP
  2. daboss

    daboss Guest

    Messages:
    2,249
    Likes Received:
    151
    Best Answers:
    0
    Trophy Points:
    0
    #2
    copy what you have and put it into a file with a js extension (e.g. fryman.js). then insert the following into the pages where you want to call the script:

    <script type="text/javascript"
    src="http://www.yourdomain/directory/fryman.js">
    </script>

    make sure the path correctly points to your file...
     
    daboss, Oct 15, 2005 IP
  3. fryman

    fryman Kiss my rep

    Messages:
    9,604
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    370
    #3
    So I just copy it and use it as an external file? I thought you would have to change the code in some way
     
    fryman, Oct 15, 2005 IP
  4. mdvaldosta

    mdvaldosta Peon

    Messages:
    4,079
    Likes Received:
    362
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Only copy the guts of the script into the file though, don't copy the

    <script language="javascript">

    </script>

    part
     
    mdvaldosta, Oct 15, 2005 IP
  5. fryman

    fryman Kiss my rep

    Messages:
    9,604
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    370
    #5
    cool! Thanks :D
     
    fryman, Oct 15, 2005 IP