Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass data between pages 1

Status
Not open for further replies.

mmaginniss

Technical User
Jun 9, 2003
20
US
I am wondering if there is a way to use Javascript to pass a value between different pages - without creating a cookie or putting the data in a database.

For example, on page 1 I have a text input field. The user enters into the input field "ABCD". Then the user clicks a link and goes to page 2. On page 2, I want to display the text "ABCD" at the top of the page. Then, the user clicks another link and goes to page 3. I want to display the text "ABCD" at the top of page 3.

If anyone knows of a way to do this i would really appreciate any help you could provide. Thx.
 
The only way to do this is to put the value in the URL, like with a form GET, or using Javascript to write the value in the URL when a link is clicked on.

Lee
 
Or try this. This is one of the great features of framesets:

Code:
INDEX.HTM
<html><head><script>myvar="XXXX"</script></head> 
<frameset><frame src="page1.htm" /></frameset>
</html>

PAGE1.HTM
<html>
<script>
function updatevar() {
   top.myvar=myform.newvar.value
}
</script>
<form name="myform" action="page2.htm" 
 onSubmit="return updatevar()">
<input type="text" id="newvar" />
<input value="Send" type="submit" />
</form></html>

PAGE2.HTM
<html><script>
document.write(top.myvar)
</script></html>

Clive
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top