//改成这样看看:
function ConfirmEdit()
{
var dd,i,Num,ChkID
Num = 0
dd = this.parent.frames('right').myform.chk.length;//改成this
for(i=0;i<dd;i++)
{if (this.parent.frames('right').document.myform.chk[i].checked ==true)//把window改成this看看
Num = Num + 1;
}
//alert(Num)看看值是多少
alert(Num);
if(Num==0)
     {
alert("必须有一个被选中!");
return false;
}
else if(Num>1)
{
alert("只能修改一个!");
return false;
}
else 
{ //在这里alert(Num);看看值是多少
alert(Num);
//改成:ChkID = window.parent.frames('right').document.myform.chk[i].value;
ChkID = this.parent.frames('right').document.myform.chk[i].value;
window.showModalDialog("123.asp?ID="+ChkID,self,"dialogHeight: 400px; dialogWidth: 500px;dialogTop: 150;dialogLeft: 250;center: yes; status=no");
    
}

}</SCRIPT>

解决方案 »

  1.   

    如果没选 num为0 会提示没选择,选两个以上会提示不能多选num为2以上
    选一个num会出现两次1,但是会出现错误
    window.parent.frames('...').document.myform.chk[...].value;为空或不是对象
    用this.parent.frames('right').document.myform.chk[i].value;
    也是出现这个问题
      

  2.   

    用this.parent.frames('right').document.myform.chk[i].value;
    你的right是一个frames的id吧,或者把frame改成
    <frameset  cols="20%,*">
        <frame name="left" src="left.html" action="right" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0">
        <frame name="right" src="right.html" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0">
    </frameset>
    用上一个frameset
    然后把那句话改成这样看看
    用this.parent.right.document.myform.chk[i].value;
      

  3.   

    name值 本来是right 没有带引号
    改成this.parent.right.document.myform.chk[i].value; 还是说为空或不是对象
      

  4.   

    我如果在最后改成
    ChkID = window.parent.frames('right').document.myform.chk[0].value;
    只能修改第一个记录,不会报错,这证明没有循环到这句
      

  5.   

    终于搞定了 谢谢52juanjuan(Fibona)给予的代码参考
    放上最后搞定的代码
    function ConfirmEdit()
    {
    var dd,i,Num,ChkID
    Num = 0
    dd = this.parent.frames('right').myform.chk.length;
    for(i=0;i<dd;i++)
    if (this.parent.frames('right').document.myform.chk[i].checked ==true)
    {
    ChkID = window.parent.frames('right').document.myform.chk[i].value;
    Num = Num + 1;
    }

    if(Num==0)
         {
    alert("必须有一个开发商被选中!");
    return false;
    }
    else if(Num>1)
    {
    alert("只能修改一个开发商!");
    return false;
    }
    else 
    {

    window.showModalDialog("Dev_Developunit_update1.asp?ID="+ChkID,self,"dialogHeight: 400px; dialogWidth: 500px;dialogTop: 150;dialogLeft: 250;center: yes; status=no");
        return true;
    }

    }