i have this javascript code:
<script type="text/javascript">
var b=document.update.branchei;
function selectItemByValue(b, <%=branche%>){
for(var i=0; i < b.options.length; i++)
{
if(b.options[i].value == <%=branche%>)
b.selectedIndex = i;
}
}
</script>
'update' is the name of the form and 'branchei' is the name of the selectbox.
Try that
var b = document.getElementsByName("branchei")[0];
Or that
var b = document.getElementsByName("branchei");
ps, why dont jQuery?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.