View Full Version : Running external scripts after loading a page.

07-16-2004, 03:17 PM
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"
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?

07-16-2004, 03:24 PM
when this script is run I cannot still need to have the page exist

07-16-2004, 04:25 PM
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.)