NEPAL | ARTICLES | KAVITAHARU | MANTHAN | COOL LINKS | GUESTBOOK | SEARCH |
|||
JAVASCRIPT NEPAL KAVITAHARU ARTICLES COOL LINKS ADD EMAIL GUESTBOOK KURAKANI FREE E-CARDS FREE SITE SUBMIT
ABOUT ME |
As I have mentioned that JavaScript treats window as an object which has properties and method to access. Window(PROPERTIES): document, bgcolor, fgcolor, default status, frame, parent, referrer, lastmodified, history, location, name etc. Window (METHODS): alert, prompt, confirm, write, writeln, close, open, setTimeout, reload, clearTimeout, blur, focus etc. Using ALERT method <script language="JavaScript"> <!-- hide from older browser alert("Welcome my friend") //--> </script> In this example a dialogue box will be displayed which will contain the message-Welcome my friend. Using CONFIRM method <script language="JavaScript"> <!-- hide from older browser var answer=confirm("jump to another javascript page") if(answer) window.location="js03.htm" //--> </script> In this example, an interactive dialogue box will be displayed with the message-jump to another javascript page. If you click OK you will be taken to that page because the window.location is addressed to that place.If you click cancel then it will be cancelled. Using PROMPT method <script language="JavaScript"> <!-- hide from older browser var answer=prompt("please enter your name") if(answer=="ncthakur"){ window.location="js04.htm" } //--> </script> In this example, an interactive dialogue box will be displayed with the message-please enter your name and unless you type ncthakur in the empty text area and click, you will not be taken to javascript page 4 of this web site because the answer to the prompt is equal to ncthakur. You can replace that answer in the code with your own.
|
Home
| About Me
| Nepal
| Articles
| Kavitaharu
| Cool Links
Javascript | Add Email | Guestbook |