<html> <head> <title> </title> <script> function show(obj){ var id = obj.id;
if(id=="s1"){ if(obj.value=="1"){ document.getElementById("t1").style.display="none"; document.getElementById("s2").style.display="block"; }else if(obj.value=="2"){ document.getElementById("t1").style.display="block"; document.getElementById("s2").style.display="none"; }else { document.getElementById("t1").style.display="none"; document.getElementById("s2").style.display="none"; }
} if(id=="s2"){ if(obj.value!=""){ document.getElementById("t1").style.display="block"; }else{ document.getElementById("t1").style.display="none"; }
}
} </script> </head> <body> <div> <select id="s1" onchange="show(this)"> <option value="">请选择</option> <option value="1">1</option> <option value="2">2</option> </select> <select id="s2" onchange="show(this)" style="display:none;"> <option value="">请选择</option> <option value="3">3</option> <option value="4">4</option> </select> <input type="text" id="t1" value="" style="display:none;"/>
</div> </body> </html>
|
以上代码类似于网易注册用户时,选择密码保护--我的“自定义的问题”弹出的文本框,其他时间不出现
阅读(1660) | 评论(0) | 转发(0) |