Passing Values Into Next Page

[Total: 0    Average: 0/5]

This example shows how to pass parameters into another page.

Body Code:

<FORM name=exf1>Enter a new PID: 
<P><INPUT NAME="pid0" TYPE="TEXT" VALUE="one"> 
<INPUT NAME="pid1" TYPE="TEXT" VALUE="two"> 
<INPUT NAME="pid2" TYPE="TEXT" VALUE="three"> 
<INPUT TYPE="BUTTON" VALUE="Update" 
    onClick="doIt()"> 
</FORM> 
<script>
function doIt() {
var _s = 'http://www.js-examples.com/' + '?';
var _s0=_s1=_s2='';
if(document.exf1.pid0.value!="") _s0 = 'pid0='+document.exf1.pid0.value+'&';
if(document.exf1.pid1.value!="") _s1 = 'pid1='+document.exf1.pid1.value+'&';
if(document.exf1.pid2.value!="") _s2 = 'pid2='+document.exf1.pid2.value+'&';
_s += _s0+_s1+_s2;
_s = _s.substr(0,_s.length-1);
document.location = _s;
}
</script>

Times Viewed: 1

Leave a Reply

Your email address will not be published. Required fields are marked *