把代码精简出来了,还是出错。求高手指点:
<HTML>部分:
<input id="crossRd1" name="crossRd" type="radio" value="1" />xxx
<input id="crossRd2" name="crossRd" type="radio" value="2" checked="checked" />yyy
<input id="crossRd3" name="crossRd" type="radio" value="3" />zzz
<input id="crossRd4" name="crossRd" type="radio" value="4" />www
<script>部分:
<script type="text/javascript">
$(document).ready(function(){
$("input[name=crossRd]").click({
if($('input[name=crossRd]:checked').val()=='1'){
alert("hi");}
});
});
</script>
【 在 cowell 的大作中提到: 】
: 不好意思,自己敲漏了,实际代码中是敲了引号的。
: if($('input[name=myRadioName]:checked').val()=='1')
: {...}
: ...................
--
FROM 192.55.54.*