我有一个promblem child.html - > parent.html我想获得价值但跨域问题

时间:2018-03-16 01:15:12

标签: javascript html5 cross-browser

child.html - > parent.html  我希望得到父值的值子值 但发生了跨性别问题 请帮帮我......

我在localhtml中测试

Parent.html     

    var openWin;

    function openChild()
    {
        // window.name = "Parent Name"; 
        window.name = "parentForm";
        // window.open("open할 window", "ChildValue", "팝업창 옵션");
        openWin = window.open("Child.html",
                "childForm", "width=570, height=350, resizable = no, scrollbars = no");    
    }

<b><font size="5" color="gray">Parent</font></b>
<br><br>
<input type="button" value="openChild" onclick="openChild()"><br>
전달할 값 : <input type="text" id="pInput">

Child.html        

    function setParentText(){
         opener.document.getElementById("pInput").value = document.getElementById("cInput").value
    }

<font size="5" color="gray">childWindow</font></b>
<input type="text" id="cInput"> <input type="button" value="submit" onclick="setParentText()">

<input type="button" value="closeWindow" onclick="window.close()">

parent view

child view

err code

0 个答案:

没有答案