
on button onclick event pass text box value and i want to pass value of variable at onclick event of button and also want to print it in textbox on the othe (next/prevoious)page
please help me

1)page1.html:
<html> <form type=get action="page2.html"> <table> <tr> <td>First Name:</td> <td><input type=text name=firstname size=10></td> </tr> <tr> <td>Last Name:</td> <td><input type=text name=lastname size=10></td> </tr> <tr> <td>Age:</td> <td><input type=text name=age size=10></td> </tr> <tr> <td colspan=2><input type=submit value="Submit"> </td> </tr> </table> </form> </html>
2)page2.html:
<html>
<script LANGUAGE="JavaScript">
function getParams(){
var idx = document.URL.indexOf('?');
var params = new Array();
if (idx != -1) {
var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
for (var i=0; i<pairs.length; i++){
nameVal = pairs[i].split('=');
params[nameVal[0]] = nameVal[1];
}
}
return params;
}
params = getParams();
firstname = unescape(params["firstname"]);
lastname = unescape(params["lastname"]);
age = unescape(params["age"]);
document.write("firstname = " + firstname + "<br>");
document.write("lastname = " + lastname + "<br>");
document.write("age = " + age + "<br>");
</script>
</html>

Thanks! It helped me!

if i set post="method" how can i send can any body please tell me
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.