/    Sign up×
Community /Pin to ProfileBookmark

Accessing variables

Hoping someone can help out here …

Creating two page – Page A calling Page B with some variables. Now when in Page B, is there anyway to access the variables of Page A without having it explicitly written out?

For example, if on Page B I put <input type=”hidden” name=”Page_A_Var” value=”foo”>, I can access it via document.forms[0].Page_A_Var.value. But what if I opt not to do this? Can I still access the value of Page_A_Var?

Any advice would be greatly appreciated.

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@JonaMar 16.2005 — [font=trebuchet ms]You'll have to explain a little further. Is Page A open at the same time that Page B is (e.g., a frame, iframe or new window)? If not, there are only two ways you can send data from Page A to Page B: cookies or a query string.[/font]
Copy linkTweet thisAlerts:
@cycle_coderauthorMar 16.2005 — Hi Jona,

Thanks for the reply - to further detailed here's the code to Page A:


-------------------------

<html>

<head>

<title>Untitled</title>

</head>

<body>

<form name="testform" action="testme.html" method="Post">

<input type="hidden" name="monkey" value="spider">

<input type="submit">

</form>

</body>

</html>



---------------------------------

Here's Page B:

<html>

<head>

<title>Untitled</title>

<script>

function find_monkey() {

alert(monkey);

}

</script>

</head>

<body>

<form>

<input type="button" value="click" onclick="find_monkey();">

</form>

</body>

</html>


-----

Now is there a way that I can program find_monkey to tell me what the value of monkey is - once it is passed from Page A to Page B?

Thanks again,

cc
Copy linkTweet thisAlerts:
@JonaMar 16.2005 — [font=trebuchet ms]No, not unless you use one of the two methods I mentioned in my previous post.[/font]
Copy linkTweet thisAlerts:
@cycle_coderauthorMar 16.2005 — Hi Jona,

Where can I find thos posting? URL?

Thanks again,

cc
Copy linkTweet thisAlerts:
@JonaMar 16.2005 — [font=trebuchet ms]The "previous post" I referenced was my first reply to this thread.[/font]
Copy linkTweet thisAlerts:
@cycle_coderauthorMar 16.2005 — I see ... re-read your earlier post. duph!
×

Success!

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

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

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