数据库查询出来的数据生成的下拉框。我要用javascript 给它指定一个值
如题!!
很急!!请大虾赐教了!!!
------解决方案--------------------d = document.getElementById( "dlistid ")
d.options[d.options.length] = new Option( "new ", "new ")
------解决方案--------------------猜测:
<select id= "s ">
<option value= "0 "> a </option>
<option value= "1 "> b </option>
<option value= "2 "> c </option>
</select>
指定一个值(0-2):
<input id= "cv ">
<input type= "button " value= "确定 " onclick= "document.getElementById( 's ').selectedIndex=document.getElementById( 'cv ').value ">
------解决方案-------------------- <select id= "s ">
<option value= "0 "> a </option>
<option value= "1 "> b </option>
<option value= "2 "> c </option>
</select>
指定一个值(0-2):
<input id= "cv ">
<input type= "button " value= "确定 " onclick= "document.getElementById( 's ').selectedIndex=document.getElementById( 'cv ').value ">
------解决方案-------------------- <select id= "s ">
<option value= "0 "> a </option>
<option value= "1 "> b </option>
<option value= "2 "> c </option>
</select>
<input type= "button " value= "确定 " onclick= "a() ">
<script language= "javascript ">
function a(){
var sel=document.getElementById( 's ').options;
for (i=0;i <sel.length;i++){
sel.options(i).value= "你想要实现的值 ";
sel.options(i).innerText= "你想要实现的值 ";
alert(sel.options(i).value);
}
}
</script>
------解决方案-------------------- <select size= "1 " name= "xuewei ">
<option value= " " > 请选择 </option>
<%=application( "xuewei ")%>
<script language= "javascript "> document.form.xuewei.value = " <%=rs( "xuewei ")%> " </script>
</select>
我知道这个就是你想要的吧!
看我的最后一帖 http://bbs.blueidea.com/thread-2733344-1-1.html