js 对隐藏的value选择框进行选中事件..要怎么做- - 自动发布信息。但是有些网页value是隐藏的document.getElementById("id").options[0].selected=true;这个脚本实现不了。。郁闷- - 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $("#typeid").val( "xxxxx" ); // no.1// no.2window.setTimeout( function(){ $("#typeid").val( "0" );} , 10 );实际项目中 建议使用no.2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title><script type="text/javascript">window.onload=function(){ var se=document.getElementById('typeid'); se.selectedIndex=0; window.setTimeout(function(){ alert(se.value) },1000);}</script></head><body><select name="typeid" id="typeid" width="80" selecti="0" style="display: none;"> <option value="0"></option></select><a href="javascript:;" id="typeid_ctrl" style="width:80px" tabindex="1" initialized="true">选择主题分类</a></body></html>不明白你的意思 function selectIt(id, index) { var selectNode = document.getElementById(id); var selected = selectNode.selectedIndex; selectNode.options[selected].removeAttribute('selected'); selectNode.selectedIndex = index; selectNode.options[index].setAttribute('selected', 'selected');} 如何FLV文件 safari 5.1 javascript 全屏 API IE8 未结束的字符常量(浏览器问题) javascript支持函数式编程的含义是什么?谁举个例子,谢谢。 JavaScript 异常try catch机制 某些"人"请进 怎么不能用JavaScript修改iframe的边框属性的? 如何将Request参数传入JAVASCRIPT方法中做为参数?? 如何得到一个对象的"兄弟"对象?? tab点击切换后,其自动切换出现紊乱 问大牛们一个createElement()的问题 能不能不在标签里写事件方法,当有事件发生时,通过js判断是什么事件,直接执行
$("#typeid").val( "xxxxx" ); // no.1// no.2
window.setTimeout( function(){
$("#typeid").val( "0" );
} , 10 );实际项目中 建议使用no.2
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript">
window.onload=function(){
var se=document.getElementById('typeid');
se.selectedIndex=0;
window.setTimeout(function(){
alert(se.value)
},1000);
}
</script>
</head><body>
<select name="typeid" id="typeid" width="80" selecti="0" style="display: none;">
<option value="0"></option>
</select>
<a href="javascript:;" id="typeid_ctrl" style="width:80px" tabindex="1" initialized="true">选择主题分类</a>
</body>
</html>
不明白你的意思
function selectIt(id, index) {
var selectNode = document.getElementById(id);
var selected = selectNode.selectedIndex;
selectNode.options[selected].removeAttribute('selected');
selectNode.selectedIndex = index;
selectNode.options[index].setAttribute('selected', 'selected');
}