File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Hidden fields in Javascript" Watch "Hidden fields in Javascript" New topic

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 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?
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2591

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 -
2) Querystring variables -
- Manish
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
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.
I agree. Here's the link:
subject: Hidden fields in Javascript
jQuery in Action, 3rd edition