/    Sign up×
Community /Pin to ProfileBookmark

Global variable

Can I send variable (var u=…)from one .htm file to an other .htm file if they are parts of a frame.
For example if top,left and main are .htm files and index is frame with top,left and main sections, can I send variable declared in javascript in one of them and use it in an other?
Thanks. Valentin.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@96turnerriSep 15.2003 — yes it is possible to do that
Copy linkTweet thisAlerts:
@Khalid_AliSep 15.2003 — this is how you can achieve this.

suppose you have a global variable in frame left,

<script.....>

var leftName="This is left frame";

now you want to access it in topFrame frame...


parent.topFrame.leftName

should give you the value,

BTW try not to use top frame name because it is used to refer to the parent window,hence could create un wanted results.
Copy linkTweet thisAlerts:
@DjamboffauthorSep 16.2003 — Thanks mr. Khalid . It works. I received the same result using hidden field of a form, but this is more natural way. Valentin.
×

Success!

Help @Djamboff 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.16,
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,
)...