//判断3个radios 向textbox赋值$('#SELLPRICE').val(num);
function TZ() {//radio事件
var radios = document.getElementsByName("C_INDEX1");
var num = $('#one').val();
if (radios[0].checked == true) {
$('#DISCAMT').val(num);//賦值
} else if (radios[1].checked == true) {
$('#DISCPERC').val(num);//賦值
/* alert($('#DISCPERC').val(num)); */
} else if (radios[2].checked == true) {
$('#SELLPRICE').val(num);//賦值
//测试
var nn=$('#SELLPRICE').val();//賦值
alert(nn+"+3");
}
}
////////////jquery中如果获取三个radio中被选中的那个radio-Web开发/Ajax的value值:
<script src="js/jquery-1.3.2.js"></script>
<script type="text/javascript">
function doit(){
alert($("input[name='rad']:checked").val());
}
</script>
<input id="rad" name="rad" type="radio" value="1" />
<input id="rad" name="rad" type="radio" value="2" />
<input id="rad" name="rad" type="radio" value="3" />
<input type="button" onclick="doit()" value="click">
jquery根据value判断是第几个的方法":
<script type="text/javascript">
if($('#singlePrt').val()=="TRUE"){
$('input[name=singlePrt]').get(0).checked = true;
}else{
$('input[name=singlePrt]').get(1).checked = true;
}
</script>
<body>
<input name="singlePrt" type="radio" id="singlePrt" value="${ ks.singlePrt }" > 單飛
<input name="singlePrt" type="radio" id="summary" value="FALSE" > 總飛
</body>