隐藏父窗口的Div,子窗口的加载 [英] Hide Div of parent window ,onload of child window

查看:119
本文介绍了隐藏父窗口的Div,子窗口的加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想加入div&将其从子窗口隐藏到父窗口的div,

所有的代码都在这里,但是子窗口中的粗线必须更改,我正在使用IE.应更改什么以代替粗线

当显示子窗口时,div处于隐藏状态,假设div具有loading.gif图片....

我正在使用IE

父窗口

I want to acces the div & hide it div of parent window from child windo,

the all code is here, but the bold line in child window must be changed,,, I am using IE,, .what should be change in place of bold line

as the child window is display the div is hide,let suppose the div has loading.gif pic....

I am using IE

Parent Window

<script type="text/javascript">
function openwindow()
{
window.showModalDialog("default4.aspx")
//retval=window.showModalDialog("default4.aspx")
//document.getElementById('text1').value=retval
}







</script>
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
<form name="frm" runat="server">
<input name="text1" type="text">
<input type="button" onclick="javascript:openwindow()" value="Open window..">

<div id="test">

This must be hide</div>

<div>

No CHange
</div>
</form>
</body>
CHild window
<head id="Head11" runat="server">
    <title>Untitled Page</title>
</head>
<script type="text/javascript">
window.onload=function changeparent()
{
//window.returnValue="Value changed.."
window.parent.document.all("test").style.visibility = "hidden" ;
}
</script>

<body>
<form id="aa" runat="server">
<input type="button" onclick="javascript:changeparent()" value="Change main window’s textbox value.." />
</form>

</body>
</html>

推荐答案

从技术上讲,子窗口和父窗口是浏览器的两个不同实例.我们称它们为子窗口和父窗口.它们彼此之间无权访问,因此单击第二个窗口中的HTML元素,就无法在一个窗口中执行任何操作.
Technically speaking the child window and parent window are two different instances of the browser. We call them as child window and parent window. They do not have access to each other.So its not possible to perform any action in one window on the click of HTML elements in second window.




如果您打开了一个窗口,则下面的代码可能对您有用,

Hi,

If your one window is open the another then below code may work for you,

window.opener.getElementById('parentDivId').style.visibility ="hidden";



试试看,让我知道

谢谢
-Amit Gajjar



Give it a try and let me know

Thanks
-Amit Gajjar


这篇关于隐藏父窗口的Div,子窗口的加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆