Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Window Open():

<html>

<head>

<script language="javascript" type="text/javascript">

function openWindow()

window.open(",""", "left=0,top=0,width=200,height=100");

</script>

</head>

<body>

<p> click to open new window </p>

<input type="button" value="open new Window" onclick="openWindow()"/>

</body>

</html>

Output:
Window close():

<html>

<head>

<script language="javascript" type="text/javascript">

var new_win;

function openWindow()

new_win=window.open("","","width=200,height=100");

function closeWindow()

new_win.close();

</script>

</head>

<body>

<p> click to open new window </p>


<input type="button" value="open new Window" onclick="openWindow()"/>

<p> Click to close new window</p>

<input type="button" value="close new Window" onclick="closeWindow()"/>

</body>

</html>

Output:

scrollTo To ():

<html>

<head>

<script language="javascript" type="text/javascript">

function scrollWindow()

scrollTo(0,1);

}
</script>

</head>

<body>

<p> click to scroll window </p>

<input type="button" value="scroll window"onclick="scrollWindow()"/>

<p> vaishnvi </p>

<p> sayali</p>

<p> mayuri </p>

<p> aarohi </p>

<p>.........window is Scrolled</p>

</body>

</html>

Output:

ScrollBy ():

<html>

<head>

<script language="javascript" type="text/javascript">

function scrollWindow()
{

scrollTo(0,100);

</script>

</head>

<body>

<p> click to scroll window </p>

<input type="button" value="scroll window"onclick="scrollWindow()"/>

<p> a </p>

<p> b </p>

<p> c </p>

<p> d </p>

<p>.........window is Scrolled</p>

</body>

</html>

Output:

setTimeout ():

<html>
<head>

<script language="javascript" type="text/javascript">

function myfunction()

setTimeout(displayfunction,5000);

function displayfunction()

alert("time out");

</script>

</head>

<body>

<p> click to set time out</p>

<input type="button" value="Set time out" onclick="myfunction()"/>

</body>

</html>

Output:

You might also like