Wednesday, May 02, 2007

Set HTML selection option value

Javascript code:

function setSelectionOption(fldid, val) {
var x=document.getElementById(fldid);
x.value=val;
}
window.onload = function(){
setSelectionOption('flddt', '<%= fld.FLDDT %>');
// where fld.FLDDT is I,M,D...
}


HTML selection:

<select id="flddt" name ="FLDDT"> <option value=" "> </option>
<option value="I">ISO</option>
<option value="M">MDY</option>
<option value="D">DMY</option>
<option value="Y">YMD</option>
<option value="U">USA</option>
<option value="E">EUR</option>
<option value="J">JPN</option>
</select>

0 Comments:

Post a Comment

<< Home