一个页面有个txt框 还有个页面都是按钮跟计算器一样
然后 2个页面同时开着 要求按了按钮 数字马上出现另一个
页面上  大家可以提供几个传值的方法吗

解决方案 »

  1.   

    兩個頁面要有關聯.
    示例:function openWin()
    {
       window.open(window.location.href,"","width=200,height=200");
    }
    function setValue(obj)
    {
       window.opener.document.getElementById(obj).value=event.srcElement.value;
    }
    <input type="button" value="open new win" onclick="openWin()">
    <input type="button" value="1" onclick="setValue('txt1')">
    <input type="button" value="2" onclick="setValue('txt2')">
    <input type="text" id="txt1">
    <input type="text" id="txt2">===========================================================
    試試.