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
    Jul 2004
    Location
    USA\California\Claremont
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Running external scripts after loading a page.

    I am making a script based program to run locally. One of the options that I need to be able to do is run external scripts from within the webpage. This means for example that I need to be able to run a script on button click or from within functions in another script etc. In addition when this script is run I cannot still need to have the page exist and thus can not use the document.write method of loading an external script unless I can put it in an invisible iframe but I have not been able to get this to work either. I also have tried to use the method where the script is simply appended to the end of the document using:
    var newscript = document.createElement("script")
    newscript.type = "text/javascript"
    newscript.src = "script.js"
    document.body.appendChild(newscript)
    but as I understand it this means that the script will be loaded into the webpage and thus any relative links that were within these script would no longer be correct. Anyway, I have been looking around for a while now and have not found a satisfactory solution yet. Is this even possible?

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    when this script is run I cannot still need to have the page exist
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "

  • #3
    New to the CF scene
    Join Date
    Jul 2004
    Location
    USA\California\Claremont
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Got it!

    Hey I finally stumbled upon a method that works so thanks for readin this and sorry to take up your time.

    (Just in case you cared i ended up running it through the shell by calling wscript.exe on the javascript file and the relative directory structure can be maintained by doing this in a bat file where the directory you run wscript.exe from is where you want it to output.)


  •  

    Posting Permissions

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