Page 1 of 1
Javascript calling on Javascript
Posted: Mon Feb 05, 2007 4:55 pm
by tecktalkcm0391
I couldn't find anything on google about this... can javascript go to another page, and get more javascript to run?
Posted: Mon Feb 05, 2007 5:33 pm
by Burrito
it can if it's a child window or if it's in another frame.
If you're reloading the parent page, then all of the js vars get cleaned and reset
Posted: Mon Feb 05, 2007 8:12 pm
by tecktalkcm0391
ok, well let me rephrase that then.... what I want to know is if this is possible:
page x.html with script on it
can go to javascript y.js and then run that script
like the include() function on php
Posted: Tue Feb 06, 2007 3:56 am
by boba
Of course you can. For example you can create new <script> element and set src of this element to y.js. It will work anywhere except Safari.
Posted: Tue Feb 06, 2007 6:16 pm
by JellyFish
Funny how you ask. Because I stumbled upon this a few days ago
http://www.codehouse.com/javascript/articles/external/.
Does safari really not support dynamically loading scripts? I wouldn't expect that.