日期:2014-05-16  浏览次数:20631 次

关于设置checkbox已经选择的问题
1.html
<input   type= "button "   name=userbutton   value= "选择产品 "   onclick= "javascript:opennewwindow( '2.html ', 'newwindow1 ', '800 ', '400 ') "> <div   id= "Product_Code "   name= "Product_Code "> </div>
2.html
<script   language= "javascript ">
function   sum1(str,inputtext){
var obj   =   window.opener.document.createElement( "input ");
var   strtext   =   window.opener.document.createElement( "span ")
strtext.id=str;
window.opener.document.all[ "Product_Code "].appendChild(strtext);
obj.type= "checkbox ";
obj.name= "Product_name ";
obj.value=str;
window.opener.document.all[ "Product_Code "].appendChild(obj);
strtext.innerHTML   =   " "+inputtext;
// window.opener.document.all[ "Product_Code "].appendChild(obj).checked;
}

</script>
<table   width= "100% "   border= "1 "   align= "center ">
<tr>

<td   width=20%> <input   type=checkbox   name=Pd_Code   onclick= "if(this.checked){return   sum1(50002981, '2A ');} "> 2A </td>
</tr> <tr>
<td   width=20%> <input   type=checkbox   name=Pd_Code   onclick= "if(this.checked){return   sum1(50002982, '3A ');} "> 3A </td>

<td   width=20%> <input   type=checkbox   name=Pd_Code   onclick= "if(this.checked){return   sum1(50002983, '4A ');} "> 4A </td>

</tr>
</table>
实现效果如下:当窗口2.html打开后 选择里面的单选框数据会同样在1.html中显示 但我想设置1.html显示后为自动选种状态不知道怎么设置,我试过obj.checked=true;无效,请问各位应该怎么处理!多谢


------解决方案--------------------

window.opener.form名.控件名.checked
------解决方案--------------------