一个单选框: " 是 否 " 两个选项
如果选 "是" 则可以填写是下面的文本框
如果选 "否" 则只能填否下面的也就是说先完成单选,才能填文本框,但是单选框与文本框都有与其对应的,不可以交叉选填能不能做到呢?请高人指点
如果选 "是" 则可以填写是下面的文本框
如果选 "否" 则只能填否下面的也就是说先完成单选,才能填文本框,但是单选框与文本框都有与其对应的,不可以交叉选填能不能做到呢?请高人指点
解决方案 »
- 我又重新改了一下代码,请教这两个按钮的样式要怎么换呢??
- 求助:解读SDK控件转化为jscript
- 浏览器兼容
- 用jquery取cellinndex的时候总是提示undefined是为什么
- jquery多次触发div hover事件,百思不得其解,请各位指教!急急急急急急
- 求javascript语句,各位达人帮帮忙
- 请问在javascript里面,在电击关闭按钮时触发什么事件啊?
- 当在HTML中做粘贴(paste)、剪切(cut)有没有事件(event)被触发?
- 有办法用js在后台将server端.doc文件下截到本地临时目录吗?
- dom形式写的页面怎么去调用外部css文件来加载样式
- document.createElement("object")要怎么用,让flash显示出来?
- 正则表达式如何提取"[]"中的内容
再事件中,只要改变相关的文本框disabled="";就可以了。
radio2 默认没有选中
div1 里面内容为是的内容 默认显示
div2 里面内容为否的内容 默认不显示在 radio1和radio2上绑定click事件,
点击radio1的时候,div1显示,div2隐藏,
点击radio2的时候,div2显示,div1隐藏
<!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=utf-8" />
<title>ceshi</title>
<style>
</style>
<script src="jquery-1.3.2.js"></script>
<script>
$(function(){ $("input[class=ok]").click(function(){
if($(this).is(":checked")){
$(this).next().next().attr("readonly",true).css("background","#ccc");
$(this).next().attr("checked",false);
}else{
$(this).next().next().attr("readonly",false).css("background","#fff");
$(this).next().attr("checked",true);
}
});
$("input[class=no]").click(function(){
if($(this).is(":checked")){
$(this).next().attr("readonly",false).css("background","#fff");
$(this).prev().attr("checked",false);
}else{
$(this).next().attr("readonly",true).css("background","#ccc");
$(this).prev().attr("checked",true);
}
});
});
</script>
</head><body>
<div id="all">
<div class="test">
<input type="radio" class="ok" />是<input type="radio" class="no" />否
<input type="text" class="text" />
</div>
<div class="test">
<input type="radio" class="ok" />是<input type="radio" class="no" />否
<input type="text" class="text" />
</div>
<div class="test">
<input type="radio" class="ok" />是<input type="radio" class="no" />否
<input type="text" class="text" />
</div>
</div></body>
</html>
则 一组状态按钮 是|否 单独一个文本框 就可以了 不必搞这么复杂
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">function btnClick(inputName, disableInputName) {
var input = document.getElementById(inputName);
var disableInputName = document.getElementById(disableInputName); input.disabled = false;
disableInputName.disabled = true;
}
</script>
</head>
<body>
<input type="radio" name="select" checked="true" onclick="btnClick('textYes', 'textNo')"></input>
<input type="text" name="textYes"></input>
<input type="radio" name="select" onclick="btnClick('textNo', 'textYes')"></input>
<input type="text" name="textNo" disabled="true"></input></body>
</html>
对不起啦