获得子页面的元素 var win = window.open("","",false); 用win就能拿到子窗口的buttonwin.getElementById(''); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var win = window.open("test.htm","","");//子页面的document为win.documentvar button = win.document.getElementById("button") 我原来就这样做的,可是不行,报错“找不到对象”我子页面的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=""这行报错了 opener.getElementById("btnSave").style.display="";parent.getElementById("btnSave").style.display="";试试这两个哪个可以 楼上的,你这是子页面获得父页面的button吧 <!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>能拿到 "sys.jsp"看看你这个页面的代码 --------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>你是不是这意思?能拿到 到底"XXX" in 元素 检测的是?? div1浮动在页面的最上面,我想点击页面的其他部分,使div消失,应该是触发什么事件? 有没有办法判断浏览器是否支持position的值可以为fixed? 关于设置label的高度和字体的颜色 100分求创建和解析XMLDOM的方法! js与vbs间的数据传递问题,请问大家了,谢谢大家的帮助啊 一个层定位的问题 asp:datagrid的标题如何去下划线??急啊!! 请大家帮忙看看!谢谢! js用addEventListener添加点击问题 [求助] 弹窗的页面如何刷新父页面? 散分(今天到新公司上班)
var button = win.document.getElementById("button")
我子页面的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=""这行报错了
<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>
能拿到
看看你这个页面的代码
<!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>你是不是这意思?
能拿到