Retrieving Parameters

[Total: 0    Average: 0/5]

This example shows how to retrieve parameters and put them into a form select list.

Body Code:

<script>
var _d = document.location.toString();
document.write(_d);
//document.write("<BR>"+_d.split("?"));
var _e = _d.split("?")[1];
var _parms = new Array();
var _valus = new Array();
// parameters must have a &!
var _f = _e.split("&");
for(var i=0;i<_f.length;i++) {
  _parms[i]=_f[i].split("=")[0];
  _valus[i]=_f[i].split("=")[1];
}
</script>

<FORM NAME="formName2"> 
<SELECT NAME="selectName2"> 

<SCRIPT LANGUAGE="JavaScript"><!-- 
for (var i=0;i<_valus.length;i++) {
  var _s=i==0?" SELECTED ":"";
    document.write('<OPTION VALUE="x" '+_s+'>' + _valus[i]); 
}
//--></SCRIPT> 
</SELECT> 
</FORM> 

Times Viewed: 0

Leave a Reply

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