Window Object Notes
Window Object Notes
Note: There is no public standard that applies to the Window object, but all
major browsers support it.
Property Description
document Returns the Document object for the window (See Document
object)
location Returns the Location object for the window (See Location
object)
navigator Returns the Navigator object for the window (See Navigator
object)
pageXOffset Returns the pixels the current document has been scrolled
(horizontally) from the upper left corner of the window
pageYOffset Returns the pixels the current document has been scrolled
(vertically) from the upper left corner of the window
screen Returns the Screen object for the window (See Screen object)
Method Description
prompt() Displays a dialog box that prompts the visitor for input
<html>
<head>
<script>
var myWindow;
function openWin() {
function closeWin() {
if (myWindow) {
myWindow.close();
function checkWin() {
if (!myWindow) {
} else {
if (myWindow.closed) {
} else {
</script>
</head>
<body>
<button onclick="openWin()">Open "myWindow"</button>
<br><br>
<br><br>
<div id="msg"></div>
</body>
</html>
Output :
<body>
<script>
function myFunction() {
</script>
</body>
</html>
Output:
Try it
<html>
<body>
<p id="demo"></p>
<script>
function myTimer() {
var t = d.toLocaleTimeString();
document.getElementById("demo").innerHTML = t;
}
function myStopFunction() {
clearInterval(myVar);
</script>
</body>
</html>
Output:
2:24:38 PM
Stop time