Hii sn00pyg4rfi3ld
Since your dropdownlist is populated from the database,if you want your requirements to be fullfill then it's not a good idea to bind all the options on the server(Think when user enter 30 then all the options with values less than 30 has removed, Now again user enter the value 2 Then it must show all the options with values equalto or greater than 2 )
So i do feel that it's better to put their those values in Array on the client side,now you can achieve ur requirement.
For example, Try this code
Hope this will help you
<script>
arrOptionval=new Array("1","2","3","4","5","6","7","8","9","10","11 ","12","13","14","15","16","17","18","19","20","21 ","22","23","24","25","26")
arrOptionname=new Array("A","B","C","D","E","F","G","H","I","J","K", "L","M","N","O","P","Q","R","S","T","U","V","w","X ","Y","Z")
function pageonload()
{
var opt
selectobj=document.getElementById("selectbox")
for(i=0;i<arrOptionval.length;i++)
{
opt=new Option(arrOptionname[i]+" ",arrOptionval[i])
selectobj[i]=opt
}
}
function textChanged(obj)
{
selectobj=document.getElementById("selectbox")
total=selectobj.length
for(i=0;i<=total;i++)
{
selectobj[total-i]=null
}
indexval=0
for(i=0;i<arrOptionval.length;i++)
{val1=parseInt(arrOptionval[i])
val2=parseInt(obj.value)
if(val1>val2){
opt=new Option(arrOptionname[i]+" ", arrOptionval[i])
selectobj[indexval]=opt
indexval++;
}
}
}
</script>
<body onload="pageonload()">
<input type=text id=inval onblur="textChanged(this)">
<select id="selectbox" size=10 multiple>
</select>
<body>
Cheers :)
vinod
|