隐藏父窗口的Div,子窗口的加载

隐藏父窗口的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