How to close this popup.... [Resolved]

Posted by sourabhghosh49-13964 under ASP.NET on 4/4/2012 | Points: 10 | Views : 1513 | Status : [Member] | Replies : 3
this is my java script code for open popup


function newWindow( p, w, h, e ) {var e = e ? e : window.event;
var x = 0;
var y = 0;
if ( e.pageY || e.pageX )
{
x = e.pageX;

y = e.pageY;

}
else if ( e.clientX || e.clientY )

{

var db = document.body;
var dde = document.documentElement;
x = e.clientX + db.scrollLeft + dde.scrollLeft;
y = e.clientY + db.scrollTop +dde.scrollTop;
}
var p = p;
var w = w;
var h = h;
var name = "iframeOne";
var id = name;
if (( "createElement" && "getElementById" ) in document )
{
var fragment =document.createDocumentFragment();
var win = document.createElement("div");
var iframe = document.createElement("iframe");
var settings = {frameBorder : 0,noResize : 0,marginHeight : 0,marginWidth : 0,width : w,height :h,style : "position : relative",name : name,id : id};
win.setAttribute( "style", "width :" + w + "px;height : " + h + "px;position : absolute; top : " + y + "px;left : " + x + "px; border : 1px solid#C0C0C0" );
win.appendChild( iframe );
for ( var properties in settings)
{
if ( iframe[ properties ] )
{
iframe[ properties ] =settings[ properties ];
continue;
}
iframe.setAttribute((properties ).toLowerCase(), settings[properties ] );

}
fragment.appendChild( win );
document.body.appendChild( fragment);

iframe.src = ( function( url )
{
var path = new Image;
path.src = url;
return path.src;
}
)( p );
}


}


please tell me how can i close this in onmouseout event of button......
thank you.

sourabh


Responses

Posted by: Jprathap on: 4/6/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
Hi,

the below script is closing the iFrame.


function closeIframe() {
var iframe = document.getElementById('iframeOne');
iframe.parentNode.removeChild(iframe);
}

Thanks & Regards
jayaprathap
OOPS CONSEPTS



sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: sourabhghosh49-13964 on: 4/7/2012 [Member] Starter | Points: 25

Up
0
Down
thank You Very Much Jprathap for helping ....

It Works.....

sourabh

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 4/7/2012 [Member] Starter | Points: 25

Up
0
Down
<html>
<head>
<title>JavaScript Window Close Example </title>
</head>
<script type="text/javascript">
function popuponclick()
{
my_window = window.open("",
"mywindow","status=1,width=350,height=150");

my_window.document.write('<h1>The Popup Window</h1>');
}

function closepopup()
{
if(false == my_window.closed)
{
my_window.close ();
}
else
{
alert('Window already closed!');
}
}
</script>
<body>
<p>
<a href="javascript: popuponclick()">Open Popup Window</a>
</p>

<p>
<a href="javascript: closepopup()">Close the Popup Window</a>
</p>
</body>
</html>

Thanks & Regards
Hari

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response