请高人指点,为什么radio是选中状态但是判断checked总是false??? var x==document.getElementById(axisId); 改成这样试试var x = document.getElementById("axisId"); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你的axisId有问题罗,获取到的对象就是没有勾选的var s=''for (var index = 0; index < 2; index++) { cmp = index; s += "<span ><input id='" + index + "_1' name='" + index + "' type='radio' value='1' " + (cmp == 1 ? "checked=true" : "") + ">主要</input></span>"+ "<span ><input id='" + index + "_2' name='" + index + "' type='radio' value='0' " + (cmp == 0 ? "checked=true" : "") + ">次要</input></span>"}document.write(s)var x = document.getElementById('0_2');alert(x.checked)//truex = document.getElementById('1_1');alert(x.checked)//true 楼主以前有一个帖子叫 系统启动时的spring注入 请问楼主还记得当时是怎么解决的么 求截取正则 <div style='display:none;'>问题 javascript的在firefox运行的问题 请问javascript 如何操作 ppt 让它翻页? 急求javascript中去掉半角全角空格的函数! 怎样改变TEXTBOX底色 ? 急! 调用table.nextPage()时会触发什么事件? Iframe和CheckBox问题 巨大的问题-----按钮的函数问题(vbs)! 急,一个更弱的问题,如何让页面和窗口一样大 求数据表该如何设计呢 一个关于闭包的问题
for (var index = 0; index < 2; index++) {
cmp = index;
s += "<span ><input id='" + index + "_1' name='" + index + "' type='radio' value='1' " + (cmp == 1 ? "checked=true" : "") + ">主要</input></span>"
+ "<span ><input id='" + index + "_2' name='" + index + "' type='radio' value='0' " + (cmp == 0 ? "checked=true" : "") + ">次要</input></span>"
}
document.write(s)var x = document.getElementById('0_2');
alert(x.checked)//true
x = document.getElementById('1_1');
alert(x.checked)//true