Faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 22 people (32%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

i want to retain values of a hidden form field on page refresh in html using javascript alone

Oct 8th, 2003 18:06
Fred Jounters, gaya sri,


If I understand You right, You could read out the hidden input-field 
with regular javascript, construct the new url to look like this
http://some.foo/myform.html?hiddenval=value 
and make this the refresh-url. Then, simply read out the 
window.location.search var and split it to your needs. For more than one 
var, use ...html?var1=thisisone&var2=somethin&......
Also: If the value of the var contains any special chars, use encodeUri 
and decodeUri !
<script type="text/javascript">
<!--//
if(window.location.search != "")
 alert(window.location.search);
//-->
</script>
Hope this helped,
Fred