Javascript calling on Javascript

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Javascript calling on Javascript

Post by tecktalkcm0391 »

I couldn't find anything on google about this... can javascript go to another page, and get more javascript to run?
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post 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
User avatar
boba
Forum Newbie
Posts: 15
Joined: Sun Feb 04, 2007 2:46 pm
Location: Kharkov, Ukraine
Contact:

Post 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.
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Post 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.
Post Reply