var win = window.open("","",false);
   
   
用win就能拿到子窗口的buttonwin.getElementById('');

解决方案 »

  1.   

    var win = window.open("test.htm","","");//子页面的document为win.document
    var button = win.document.getElementById("button")
      

  2.   

    我原来就这样做的,可是不行,报错“找不到对象”
    我子页面的button是display:none的,我在父窗口打开它时想让它显示
    代码:
    var url = "sys.jsp";
    var winStyle = 'location=no,width=500px,height=300px,toolbar=no,status=no,directories=no,menubar=no';
    win = window.open(url,"",winStyle);
    win.document.getElementById("btnSave").style.display=""
    结果在win.document.getElementById("btnSave").style.display=""这行报错了
      

  3.   

    opener.getElementById("btnSave").style.display="";parent.getElementById("btnSave").style.display="";试试这两个哪个可以
      

  4.   

    楼上的,你这是子页面获得父页面的button吧
      

  5.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html lang="gb2312" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
    <script>
    window.onload = function(){
    var win = window.open("","",false);
    win.document.write('<input type="button" id="aa" value="aa" />');
    win.document.getElementById('aa').style.display = 'none';
    }
    </script>
    </head>
    <body>
    </body>
    </html>
    能拿到
      

  6.   

    "sys.jsp"
    看看你这个页面的代码
      

  7.   

    --------a页面--------
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html lang="gb2312" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
    <script>
    window.onload = function(){
    var win = window.open("b.html","",false);
    alert(win.document.getElementById('aa').value);
    win.document.getElementById('aa').style.display = 'none';
    }
    </script>
    </head>
    <body>
    </body>
    </html>
    -
    ---------b页面---------
    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head><body>
    <input type="button" id="aa" value="aa" />
    </body>
    </html>你是不是这意思?
    能拿到