请教一个radio选中的问题 两个radio第一个选中禁用某个文本框 第二个选中再启用该文本框 来回选择不能出错 用什么事件最合适 如何写js 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script>function check(){ if( ){ }}</script>表单form有失去焦点的事件 radio的话应该是根据selected的值来判断比较合适。 <html><head> <title>Sample</title> <script type="text/javascript"> function change(){ var _text=document.getElementById("text"); if(radio[0].checked){ _text.disabled=true; } if(radio[1].checked){ _text.disabled=false; } } </script> </head><body> <input type=radio name="radio" CHECKED onclick="change();" />First <input type=radio name="radio" onclick="change();" />Second <br/> <input type="text" id="text" value="文本框" disabled="true"/> </body></html> 如果是select 和文本框是一样的吗 不一样了,隐藏显示都是同样的代码。获得select 的值,要用document.getElementById("select").value radio的话应该是根据selected的值来判断比较合适。 现在我能让它禁用 但是再点激活时不管用 是怎么回事 下面我贴上代码<input name="toAdd" id="radio1" type="radio" value="重新选择地址" checked onclick="checkSelectAddress()"/>激活 <input name="toAdd" id="radio2" type="radio" value="个人信息地址" onclick="checkSelectAddress()"/>禁用function checkSelectAddress(){ var pro=document.getElementById("pro"); var city=document.getElementById("city"); var area=document.getElementById("area"); var addr=document.getElementById("address") var radio=document.getElementsByName("toAdd"); if(radio[0].checked){ pro.setAttribute("disabled",true); city.setAttribute("disabled",true); area.setAttribute("disabled",true); addr.setAttribute("disabled",true); } if(radio[1].checked){ pro.setAttribute("disabled",false); city.setAttribute("disabled",false); area.setAttribute("disabled",false); addr.setAttribute("disabled",false); } } jsp连接sql2k的问题 js文件中跳转页面并且传递参数 form里面得脚本无法显示 又是乱码的问题,找了好多办法就是解决不了 jforum单点登录为管理员身份 请问我的IE不能显示Applet怎么办,IE有版本限制吗? 100 紧急求救!突然出现的问题!重启也没用! 在servlet中给request添加参数,可以做到吗? 各位大侠,帮帮我,写JSP的用户注册程序需要一个加密算法的bean。很急,在线等! 关于博客系统中图片的存储与模糊搜索问题怎么解决。 关于js与iframe的问题 Eclipse3.6+tomcat6.0+jdk1.6 页面总是乱码!
function check(){
if( ){
}
}
</script>
表单form有失去焦点的事件
<html>
<head>
<title>Sample</title>
<script type="text/javascript">
function change(){
var _text=document.getElementById("text");
if(radio[0].checked){
_text.disabled=true;
}
if(radio[1].checked){
_text.disabled=false;
}
}
</script>
</head>
<body>
<input type=radio name="radio" CHECKED onclick="change();" />First
<input type=radio name="radio" onclick="change();" />Second
<br/>
<input type="text" id="text" value="文本框" disabled="true"/>
</body>
</html>
获得select 的值,要用document.getElementById("select").value
function checkSelectAddress(){
var pro=document.getElementById("pro");
var city=document.getElementById("city");
var area=document.getElementById("area");
var addr=document.getElementById("address")
var radio=document.getElementsByName("toAdd");
if(radio[0].checked){
pro.setAttribute("disabled",true);
city.setAttribute("disabled",true);
area.setAttribute("disabled",true);
addr.setAttribute("disabled",true);
}
if(radio[1].checked){
pro.setAttribute("disabled",false);
city.setAttribute("disabled",false);
area.setAttribute("disabled",false);
addr.setAttribute("disabled",false);
}
}