日期:2014-05-16 浏览次数:20543 次
    function emuladd(){
        newopen = window.open("","test","status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,top=200,left=100,width=850,height=450");
        document.forms[0].action="testAddLowCusAllInfo.html?selectButtonMenu=5&flag="+'booking';
        document.forms[0].target="test";
        document.forms[0].submit();
        intervalFunc = setInterval('reloadPage()',10);
    }
    function reloadPage(){
        if(newopen.closed){
            window.clearInterval(intervalFunc);
            window.location.href = "bizBookingProStartOpen.html?projectkind="+$('projectkind').value;
        }
    }
         alert("保存成功");
    window.opener.document.getElementById("index_0011").value = $('customname').value;
         window.close();
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>无标题页</title>
<script language="javascript">
function openwin()
{
    var url="2.html";
    var mydata=showModalDialog(url,null,"dialogWidth:300px;dialogHeight:120px;center:yes;help:No;status:no;resizable:Yes;edge:sunken");//得到子窗口返回值
    if(mydata)
     alert("您从子窗口输入的值为:" +mydata.value);
}
</script>
</head>
<body>
    <input id="Button1" type="button" value="打开窗口" onclick="openwin()" />
</body>
</html>
------解决方案--------------------
window.opener --> parent
------解决方案--------------------
<script>
function $(s){
  return document.getElementById(s);
}
function emuladd(){
        newopen = window.open("","test","status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,top=200,left=100,width=850,height=450");
        document.forms[0].action="testAddLowCusAllInfo.html?selectButtonMenu=5&flag="+'booking';
        document.forms[0].target="test";
        document.forms[0].submit();
        intervalFunc = setInterval('reloadPage()',10);
    }
    function reloadPage(){
        if(newopen.closed){
            window.clearInterval(intervalFunc);
            window.location.href = "bizBookingProStartOpen.html?projectkind="+$('projectkind').value;
        }
    }
</script>
<form>
<input type="text" id="index_0011">
<input type="text" id="projectkind" value="xxx">
<input type="button" onclick="emuladd()">
</form>
------解决方案--------------------
没有任何问题。
把 $('customname').value; 改成字符串 常量 试试。
------解决方案--------------------
用法是没有任何问题的。父窗口得不到值应该是其他方面的原因。代码列举的不详细,不能判断具体原因。
可先alert下$('customname').value的值,看看能否得到。