求一个效果 多个选项,checkbox单选或多选,最后一项选项是“其他”,后面带一个文本框,当没有勾选时,文本框默认disabled,如果选择该项,则文本框被激活。求一个该效果的代码实例。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <input type="checkbox" />选项1<br /><input type="checkbox" onclick="var txt = document.getElementById('txt'); if (this.checked) txt.style.display = ''; else txt.style.display = 'none';" />其他 <input type="text" id="txt" style="display:none;" /> <!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> <title></title> <script language="javascript"> function test(obj) { var obj_input = document.getElementById("input_text"); if (obj.checked) { obj_input.disabled = false; obj_input.focus(); } else { obj_input.disabled = true; } } </script></head><body><input type="checkbox" value="0" id="cb_0" /><label for="cb_0">0</label><br /><input type="checkbox" value="1" id="cb_1" /><label for="cb_1">1</label><br /><input type="checkbox" id="cb_2" value="2" /><label for="cb_2">2</label><br /><input type="checkbox" id="cb_3" onclick="test(this)" value="-1" /><label for="cb_3">其他</label><input type="text" id="input_text" disabled="true" /> </body></html> 关于键盘、鼠标事件对IE浏览器的影响 jquery中hide()和show()方法的问题,求帮助。 如何根据用户ip地址显示不同页面内容 跪求JS的(高,低,中)手来帮我解释一下。。。。。。。。 ★★★★★简单的JS变量问题★★★★★ extjs如何将数组提交到后台? 在ie中怎么移除一个指定的对象? 100分求:JavaScript 精美菜单!! 为什么我得ie只要是javascript的链接都点不开啊? jQuery UI 可拖拽部件的几个问题 初学JS遇到老师给的一个题目:用JS分析C程序 js prototype和this的一些用法,大家来教教。
<input type="checkbox" onclick="var txt = document.getElementById('txt'); if (this.checked) txt.style.display = ''; else txt.style.display = 'none';" />其他 <input type="text" id="txt" style="display:none;" />
<!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>
<title></title>
<script language="javascript">
function test(obj)
{
var obj_input = document.getElementById("input_text");
if (obj.checked)
{
obj_input.disabled = false;
obj_input.focus();
}
else
{
obj_input.disabled = true;
}
}
</script>
</head>
<body>
<input type="checkbox" value="0" id="cb_0" /><label for="cb_0">0</label><br /><input type="checkbox" value="1" id="cb_1" /><label for="cb_1">1</label><br /><input type="checkbox" id="cb_2" value="2" /><label for="cb_2">2</label><br /><input type="checkbox" id="cb_3" onclick="test(this)" value="-1" /><label for="cb_3">其他</label><input type="text" id="input_text" disabled="true" />
</body>
</html>