主  题:  如何在js中实现readonly对属性的操作?我的js如下:
<script language=JavaScript>
function xuanze(){
document.thisform.syrq.readOnly=true;
window.open("/jsp/runrecord/selectsylx.jsp?"toolbar=no, status=no,menubar=no, scrollbars=yes,resizable=no,width=350,height=350,left="+(window.screen.width-400)/2+",top="+(window.screen.height-300)/2+'resizable=true"');
}
</script>
这里是form表单:
<form name=thisform method=post action="PBD_SYBGadd1.jsp" onsubmit="return checkdata()" >
 <td class=list>试验日期</td>
        <td class=rightlist>
        <input name="syrq" maxlength="10" type=text class=textfield size=25 銆€onclick='popUpCalendar(this, this, "yyyy-mm-dd")'>
        </td>
</form> <input name=sub type=button class=button value="保存" onclick="xuanze()">
当我打开一个子页面的同时,我想用js控制父窗口的试验日期这个属性为readonly,我用了document.thisform.syrq.readOnly=true;
但是老是不成功,请各位指教!!!!

解决方案 »

  1.   

    单这句代码是没有问题的,问题出在你的 window.open() 这句代码里:
    在碰到这种问题的时候你可以一句句代码注释排除法找到出错的地方。
    你的window.open里的引号很混乱,双引号与单引号乱用了。
      

  2.   

    window.open("/jsp/runrecord/selectsylx.jsp?","","toolbar=no, status=no,menubar=no, scrollbars=yes,resizable=no,width=350,height=350,left="+(window.screen.width-400)/2+",top="+(window.screen.height-300)/2+"resizable=true");
      

  3.   

    谢谢各位,我的问题已经解决了,我的试验日期这个字段用了个日历控件,readonly好象不起作用,我换了个disabled,结果成功了.
    document.thisform.syrq.disabled=true;