/    Sign up×
Community /Pin to ProfileBookmark

passing variables between frames

Does this work?? I have two frames each referencing the same js file, does this mean that if one frame sets a variable the other frame will see that variable as set (if that makes sense)?

IxxI

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@khalidali63May 27.2003 — If both frames are importing same *.js file then no,because each will have their own instance.

ifyou want to use one js file in a way that both frames can see the code values being added /deleted in either of the frames,then you need to import the *
.js file in the frameset page.

and reference the js file functions/variables using following pattern

parent.functionName()

or parent.variableName
Copy linkTweet thisAlerts:
@IxxIauthorMay 27.2003 — Thanks Khalid,

Does that work the same for timeouts? If I have this.timeoutID2=window.setTimeout("parent.move()",500) in one frame and window.clearTimeout(this.timeoutID2) in another, should those be changed?

IxxI
Copy linkTweet thisAlerts:
@khalidali63May 27.2003 — It looks correct to me.though,I'd need to look at the actual pages referencing these mthods and the actual js file.
Copy linkTweet thisAlerts:
@IxxIauthorMay 27.2003 — EDIT: Sorry, ignore that one... ?

IxxI
Copy linkTweet thisAlerts:
@khalidali63May 27.2003 — you got it buddy...

Yes it will

parent .frameName.document.getElementById
Copy linkTweet thisAlerts:
@IxxIauthorMay 28.2003 — EDIT: posted in a different thread, sort of unrelated really
×

Success!

Help @IxxI spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...