Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hidden fields in Javascript

 
Veni Velkoor
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to pass Hidden fields from page to page in a JSP/HTML page and access them using Javascript...in other words if I pass "amount =A" from page 1 to page 2 then how can I access the value of "amount" on Page 2 using Javascript...? Is there a way to do this?
Thanks!
 
Manish Hatwalne
Ranch Hand
Posts: 2591
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two ways of doing this using client side javascript.
You can either use cookies to store information across pages, or use a querystring such as page2.html?amount=1020 to pass the info. and retrieve it on page 2 using javascript. See if following articles are of any help.
1) Cookies - http://www.technofundo.com/tech/js/jscookies.html
2) Querystring variables - http://www.technofundo.com/tech/js/JSGoodies.html
HTH,
- Manish
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Veni
If the original page is a form that is being submitted you can also use the input tag hidden type to pass variables. they'll get passed in whatever way you set the form to be submitted - get or post. Then they are accessed the same as all of the other form elements from the form.
Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic