Download presentation
Presentation is loading. Please wait.
1
More JavaScript
2
Objective Hierarchy of Objects document.bgColor document.fgColor
document.linkColor document.vlinkColor window.open() window.close() window.location confirm() window.moveBy()
3
Hierarchy of Objects Objects follow a strict hierarchy where the window object is the very top level. Such as: window.alert() Because window is the top level object it can be omitted. alert(); The second level of object is window.document such as: document.write(), document.bgcolor, etc..
4
Cont.. document Window alert() Prompt() Confirm() . bgColor, fgColor,
linkColor vlinkColor
5
document.bgColor and document.fgColor
document.bgColor is for changing the background color of page document.fgColor is for changing the font color of page Example <html><head>< title> background and font color</title></head> <body><p> This can be annoying... <script type=“text/javascript language="javascript"> document.bgColor=“red”; document.fgColor=“blue”; </script> </p> </body> </html>
6
document.linkColor and document.vlinkColor
document.linkColor is for changing the color of unvisited hyper links document.vlinkColor is for changing the color of visited links Example <html><head><title> link color</title></head> <body><p> This can be annoying... <script type=“text/javascript language="javascript"> document.linkColor=“red”; document.vlinkColor=“blue”; </script> </p></body></html>
7
window.open() and window.close()
window.open() is for opening anew window window.close() is for closing a window example <html><head><title> open and close window</title></head> <body><p> <script type=“text/javascript language="javascript"> window.open(“ window.close(); </script> </p></body></html>
8
window.location window.location is for changing the location of a window example html><head></head> <body> <p> Look at the location on top! <script language="javascript"> newpage=prompt("Enter a URL“," window.location=newpage; </script> </center> </body> </html>
9
Confirm() Confirm() is a method that produce dialog boxes when called
It is used to get user confirmation from a dialog box containing an OK button that returns true to the script and a cancel button that returns false to the script
10
Cont.. ask= confirm(“do you want to open a new window?”); If (ask){
window.open(); } Else{ Alert(“you chose to not open a new window”);
11
window.moveBy() window.moveBy() is for moving a window either horizontally, vertically, or both, by the specified amount in pixels <html> <head> </head> <body> <p> Did the page just move? <script language="javascript"> answer = confirm("Are you ready?"); if (answer) { window.moveBy(100,100); } </script> </p> </body> </html>
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.