By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,712 Members | 2,174 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,712 IT Pros & Developers. It's quick & easy.

Pass a GET argument from one page to another

P: n/a
I need to have a static html page basically pass all GET arguments from one
page to another. For example, I'm on page A. It has "x=12&y=45". There's
a link on page A that goes to page B. Page B has a link to page C.
Basically what page B needs to do is pass the "x=12&y=45" to page C. It
doesn't need to do anything other than pass it.

How can I do this?
Sep 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Shabam" <ch*****@yomama-nospam.com> wrote in message
news:vd********************@adelphia.com...
I need to have a static html page basically pass all GET arguments from one page to another. For example, I'm on page A. It has "x=12&y=45". There's a link on page A that goes to page B. Page B has a link to page C.
Basically what page B needs to do is pass the "x=12&y=45" to page C. It
doesn't need to do anything other than pass it.

How can I do this?

Is this what you're looking for?
JavaScript must be enabled for this to work.

http://localhost/page1.htm?x=12&y=45
<html>
<head>
<title>page1.htm</title>
<script type="text/javascript">
function next() {
location.href = "page2.htm" + location.search;
}
</script>
</head>
<body>
<a href="javascript:next()">page2</a>
</body>
</html>
<html>
<head>
<title>page2.htm</title>
<script type="text/javascript">
function next() {
location.href = "page3.htm" + location.search;
}
</script>
</head>
<body>
<a href="javascript:next()">page3</a>
</body>
</html>
<html>
<head>
<title>page3.htm</title>
<script type="text/javascript">
alert(location.search);
</script>
</head>
<body>
</body>
</html>
Sep 17 '05 #2

P: n/a
["Followup-To:" header set to alt.comp.lang.javascript.]
On 2005-09-17, Shabam <ch*****@yomama-nospam.com> wrote:

I need to have a static html page basically pass all GET arguments from one
page to another. For example, I'm on page A. It has "x=12&y=45". There's
a link on page A that goes to page B. Page B has a link to page C.
Basically what page B needs to do is pass the "x=12&y=45" to page C. It
doesn't need to do anything other than pass it.

How can I do this?


pass them using get, and grab from document.location.query using javasccript.

you'll need to unescape() them before using them.

--

Bye.
Jasen
Oct 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.