Pass a GET argument from one page to another

S

Shabam

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?
 
M

McKirahan

Shabam said:
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>
 
J

Jasen Betts

["Followup-To:" header set to alt.comp.lang.javascript.]
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top