Pass Parms Escaped

[Total: 0    Average: 0/5]

Passing parameters and unescaped text.

Head Code:

<script>
var _c="";
var _l=document.location.toString().split("?"); /* now _l is the parameters */
/* document.write("_l="+_l+"<BR>"); */



var _m ="";
if(_l[1])
{
 _m = _l[1].split("&");                /* now _m is an array of all parameters */
}

else{
_m = ["mango", "banana", "cherry", "pear"];          /* define _m  default parameters */
}


document.write('<Font> '+unescape(_m[0])+' '+unescape(_m[1])+' '+unescape(_m[2])+' '+unescape(_m[3])+' </font>' );
</script>

Body Code:

<script>
function doIt()
{
  document.location=document.location+"?"+document.tf.t1.value+"&"+document.tf.t2.value+"&"+document.tf.t3.value+"&"+document.tf.t4.value;
}
</script>
This form posts the paramters to this same page
<form name=tf>
<input type=text name=t1 value="one a">
<input type=text name=t2 value="two b">
<input type=text name=t3 value="three c">
<input type=text name=t4 value="four d">
<input type=button onclick="doIt()" value="Submit">
</form>

Times Viewed: 0

Leave a Reply

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