on 07-03-2007 9:43 PM
hi all...
I just want to know how to select the first item of a dropdown list as its default value instead of the value "ALL" in web application designer using javascript.
If someone can help me with this i will be very grateful.
Thanks and regards.
use selectedIndex to set by index
use value to set a value
<HTML>
<HEAD>
<TITLE> Select </TITLE>
<script>
function sel(index) {
document.getElementById("selectionBox").selectedIndex=index;
}
function selVal(index) {
document.getElementById("selectionBox").value=index;
}
</script>
</HEAD>
<BODY onload1="sel(1)" onload="selVal('v2')">
<select id="selectionBox">
<option value="v0" >Zero</option>
<option value="v1" >One</option>
<option value="v2" >Two</option>
</select>
</BODY>
</HTML>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.