Definition and Usage..
The close() method closes the current window.
Tip: This method is often used together with the open() method.
Return Value: No return value
Syntax: window.close()
Differents way how to declare close() Method in program.
CODING:The close() method closes the current window.
Tip: This method is often used together with the open() method.
Return Value: No return value
Syntax: window.close()
Differents way how to declare close() Method in program.
<!DOCTYPE html>
<html>
<body>
<button onclick="openWin()">Open Our WebSite</button>
<button onclick="closeWin()">Close Our WebSite</button>
<script>
var web;
function openWin() {
web = window.open("http://cprogramaboutexample.blogspot.in", "_blank", "width=800, height=400");
}
function closeWin() {
web.close();
}
</script>
</body>
</html>
<html>
<body>
<button onclick="openWin()">Open Our WebSite</button>
<button onclick="closeWin()">Close Our WebSite</button>
<script>
var web;
function openWin() {
web = window.open("http://cprogramaboutexample.blogspot.in", "_blank", "width=800, height=400");
}
function closeWin() {
web.close();
}
</script>
</body>
</html>
Comments
Post a Comment