wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Hidden fields in Javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Hidden fields in Javascript" Watch "Hidden fields in Javascript" New topic
Author

Hidden fields in Javascript

Veni Velkoor
Ranch Hand

Joined: Oct 17, 2001
Posts: 65
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

Joined: Sep 22, 2001
Posts: 2578

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

Joined: May 10, 2001
Posts: 3244
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
 
wood burning stoves
 
subject: Hidden fields in Javascript
 
Similar Threads
Hidden large text field?
HTML Hidden value
Passing JSF values in a JavaScript on load function
pass the values from HTML to jsp page
passing parameters with LookupDispatchAction