Specializations

Friday, May 9, 2014

How to close iframe using javascript + C# script registery

<html>


<head>

<script language="javascript">

function myclose1()
{
window.close();

}


function myclose2()
{
parent.window.close();

}



function myclose3()
{
top.window.close();

}



function myclose4()
{
parent.parentClose();

}

function parentClose()
{
window.close();
}





function myclose1()
{
window.close();

}


</script>

</head>
<body>

<input type="button" value="Close" onclick="myclose1();"/>
<br/>
<input type="button" value="Close" onclick="myclose2();"/>
<br/>
<input type="button" value="Close" onclick="myclose3();"/>
<br/>
<input type="button" value="Close" onclick="myclose4();"/>
<br/>
<input type="button" value="Close" onclick="myclose5();"/>
<br/>
<a href="javascript: window.parent.closeIframe()">Close</a>
<br/>
<a href="window.parent.document.getElementById('theIframe').parentNode.removeChild(window.parent.document.getElementById('theIframe'))">Close</a>
</body>
</html>


C#.net

 string JsScriptValue = "top.window.close();";
           
                 
                ScriptManager.RegisterStartupScript(this, GetType(), "YourUniqueScriptKey", JsScriptValue, true);

No comments:

Post a Comment