|
10/4 -
DIV Template
|
||
Javascript Alerts
Javascript alerts are useful little things. They can notify the user of an error they may have caused, or just plain annoy them.
To create a Javascript alert, simply use the following code, which I will explain later.
The '<script type="text/javascript">' part notifies the browser that the code ahead will be written in Javascript. The 'alert("Text which appears in alert");' parts tells the browser to create an alert, reading 'Text which appears in alert'. Finally, the '</script>' part notifies the browser to quit Javascript mode, and return to normal HTML Mode. To add a line break in an alert box, use the following code which I shall explain later.
Seeing as I've explained parts of the code before, I'll just explain the new elements. The 'This is line one." + '\n' + "Where as this is line two!' part prints 'This is line one.' on the first line, then prints 'Where as this is line two!' on the second line. The ' + '\n' + ' Notifies the browser where to place the line break. That's all for Javascript alerts. Have fun! |
||