JavaScript OnLoad() and OnUnload() Methods


Using OnLoad()

<html>
<head>
 <title>JavaScript Popup</title>
</head>
<script type="text/javascript">
function poponload()
{
    testwindow = window.open("", "mywindow", "location=1,status=1,scrollbars=1,width=300,height=300");
    testwindow.moveTo(0, 0);
}
</script>
<body onload="javascript: poponload()">
<h1>JavaScript Popup</h1>
</body>
</html>

Using OnUnload()

<html>
<head>
 <title>JavaScript Popup</title>
</head>
<script type="text/javascript">
function exitpop()
{
    my_window = window.open("", "mywindow1", "status=1,width=300,height=200");
    my_window.document.write('<h1>Popup Example</h1>');
}
</script>
<body onunload="javascript: exitpop()" >
<h1>JavaScript Popup Example 4</h1>
</body>
</html>

Comments

Popular posts from this blog

Migrating database from ASP.NET Identity to ASP.NET Core Identity

Customize User's Profile in ASP.NET Identity System

Lambda two tables and three tables inner join code samples