Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2003
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to call a js file

    I need to be able to call a js file from within a document.write staement. Here is an example of the document.write statement, I am currently using.

    if(docloc==urls[16]){
    document.write('<a href="mailtoostmaster@traderdepot.com"><img src ="http://www.traderdepot.com/Bannerforbusiness.jpg"></a>')

    If the document location is equal to a given url a certain banner will be displayed.

    Instead of using the <a href="mailtoostmaster@traderdepot.com"><img src ="http://www.traderdepot.com/Bannerforbusiness.jpg"></a> I am wanting to use src="jsfile.js" for example.

    When I place the src="jsfile.js" in the document.write statement the code stops working.

    What should the code look like, to pull in the external js file.

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    Regular Coder
    Join Date
    Apr 2003
    Location
    Northern California
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <javascript src="javascript.js">
    </javascript>
    -When you do things right, people won't be sure you've done anything at all


  •  

    Posting Permissions

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