/    Sign up×
Community /Pin to ProfileBookmark

passing variable from one page to another

Hello
I’m new to this forum and a newbie with javascript. I hope someone can help me with this:
I have an html page that links to a javascript, I need a variable in this javascript to be transfered and displayed on another html page.
Can you transfer a variable from one page to the other and how?
If possible please include the code … and where to put it.
I hope this was clear.
Steph

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Warren86Oct 15.2004 — ---------Main document ---------

<HTML>

<Head>

<Script Language=JavaScript>

var anyThing = "This_Gets_Transferred" // no spaces allowed

function nextPage(xferThis){

window.open("xferPage.html",xferThis);
}


</Script>

</Head>

<Body>

<br><br>

<center>

<input type=button value="Next Page" onClick="nextPage(anyThing)">

</center>

</Body>

</HTML>

----------XferPage.html ----------

<HTML>

<Head>

<Script Language=JavaScript>

var somethingUseful = window.name;

</Script>

</Head>

<Body>

<Div id=isGlobal></Div>

<Script>

isGlobal.innerHTML = somethingUseful;

</Script>

</Body>

</HTML>
Copy linkTweet thisAlerts:
@scuvignyauthorOct 15.2004 — Thanks Warren, I'll give that a try!
×

Success!

Help @scuvigny 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.6,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...