|
Javascript Alert Example This text only gets loaded AFTER the alert box is closed...The following <script> section is placed into the <head> section of your html; view the source code of this html page for full coding. |
| <script
language="javascript"> document.write(" If you can read this, then your browser is javascript-enabled. "); window.alert(" Push my button! "); </script> |
| The <script
language="javascript"> tag tells the browser to begin
interpreting javascript commands and syntax.
Notice the DOM addressing; write is a javascript command to "write the following string (series of alphanumeric letters or numbers)", and document is the current document. write to the current document, "If you can read this, then your browser is javascript-enabled". After that command has been read and
executed, the next command is read and executed: The alert box's button must be pushed before the script can finish, and then the <body> section of the html may load, and you can see this explanation text.
|