前端页面 JS,HTML
2011-02-16 10:08 hanwesley 阅读(312) 评论(0) 编辑 收藏 举报JS操作Select
<option value="-25">QQ会员</option>
<select id="select" name="cat" style="width:130px;" onChange="changeResPrice(this);">
obj 为select 对应ID对应对象
obj=document.getElementById("select");
alert(obj.options[obj.selectedIndex].text); QQ会员
alert(obj.options[obj.selectedIndex].value); -25
<script type="text/javascript">
function tab(n){
var goods_con_title = document.getElementById("goods_con_title");
var len_li_tab = goods_con_title.getElementsByTagName("h3").length;
for(i=1;i<=len_li_tab;i++){
if(i == n){
document.getElementById("tab_catalog"+i).className = "current";
}else{
document.getElementById("tab_catalog"+i).className = "";
}
}
switch(n){
case 2:{
document.getElementById('needCheck').style.display='none';
document.getElementById('campaignType').style.display='none';
break;
}
case 1:{
document.getElementById('needCheck').style.display='';
document.getElementById('campaignType').style.display='';
}
}
}
</script>