<html>
<body>
<%
  Randomize
          rad=int(130*rnd+1)
%>
<form id="my1" name="my1" > 
       <input type="text" name="txts" id="txts" onClick="javascript:ShowDialog('namelist.asp?id=<%response.Write(rad)%>',this.id,this.form.id,10,100) ;"/>
 <input type="text" name="txt2" id="txt2" onClick="javascript:ShowDialog('namelist.asp?id=<%response.Write(rad)%>',this.id,this.form.id,10,100) ;"/>
</form>
 
</body> 
</html>
<script language="JavaScript"> 
function ShowDialog(url,whichText,whichForm,width, height, optValidate) {  
  var arr = showModalDialog(url,window, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:on;status:off;resizable:on");

</script>
namelist.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--#include file=commom/connect_servers.asp-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>姓名列表</title>
</head><body><form id="form1" name="form1"> 
<%
strs="select companyid,companypersonname from companyTable"
rss.open strs,conns,1,3
 if not rss.eof then 
  while not rss.eof
  idss=Trim(rss("companyid"))
  names=Trim(rss("companypersonname"))
%>
<table width="95%" border="1" cellspacing="1" cellpadding="1">
  <tr>
    <td width="16%"> 
          <input type="checkbox" value="<%response.Write(names)%>" id="box_<%response.Write(idss)%>"  onchange="javascript:sends(this.id)" />&nbsp;<%response.Write(names)%> </td>
  </tr>
</table>
 
 <%
rss.movenext
wend
else
response.Write("没有姓名")
end if
%>   
</form> 
</body>
</html>
<script type="text/javascript"> 
 function sends(a)
 { 
    var a;   
var whichT=window.dialogArguments.whichText;
var whichF=window.dialogArguments.whichForm;
alert (whichT);
alert (whichF);

var b=document.getElementById(a).value;   
         var c=eval("document.form1."+ a).checked;  
  d=eval("window.dialogArguments.document.my1."+whichText+".value");
  if(c)  { 
    alert (d);
                    }
}
</script>  
页面红色的部分为主要代码。但是namelist里面获取不到值。是不是哪里错了啊?请教大虾们

解决方案 »

  1.   

    function ShowDialog(url,whichText,whichForm,width, height, optValidate) {//方法里的参数不写在下边的showModalDialog里就能取到么?没这个用过,不敢确定 学习  
      var arr = showModalDialog(url,window, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:on;status:off;resizable:on");
    }
      

  2.   

    后头自己搞定了
    加这句
     window.whichT=whichText;
     window.whichF=whichForm;
    取值的时候
    var T=window.dialogArguments.whichT;
    var F=window.dialogArguments.whichF;
    用这两句就可以了。我搞了半天  郁闷。再请教
        var thistext;  
    var thisform; 
    var T=window.dialogArguments.whichT;
    var F=window.dialogArguments.whichF;
    var b=document.getElementById(thistext).value;   
        var c=eval("document."+thisform+"."+ thistext).checked;  
     var d=eval("window.dialogArguments.document."+F+"."+T).value;
      if(c)  {   
          d =d + b + " "; 
                 }
    }这个地方d =d + b + " ";
     咋没效果呢?请指教下
      

  3.   

    if(C)确定c为true么?
      

  4.   

    对!
    如果你 alert(c)   就可以看到是 true目前关键是 d =d + b + " ";  
     这句 不起作用了 郁闷
      

  5.   

    d =d + b + " "; 
    d的引用变了,不是原来的对象了,当然不行咯
      

  6.   

    晕了   
    d =d + b + " "; 
    这样是对的哈。
     是缓存的原因。清除缓存就搞定了  。呵呵。谢谢各位了哈。