|
| JAVASCRIPT ALERT FUNCTION
The alert function, alert(), is an in-built javascript function that allows for the displaying of an alert message.
Takes a string or combination of string and variables to output as it's argument and outputs them accordingly.
Example: String Only
<script type="text/javascript">
alert("This is Bond, James Bond");
</script>
The above will alert a message of: This is Bond, James Bond
Example: String And Variable Combined
<script type="text/javascript">
var name ="James";
alert("Hello " + name);
</script>
The above will alert a message of: Hello James. Note that strings and variables are separated by the concatenation operator +. Also note that in the alert statement, strings have double (can be single) quotation marks whilst variables do not.
See Also:
alert()
Displays an alert box with a message and an OK button.
back()
Enables user to go to previous page in the browser's history list - just like using the browsers back button.
prompt()
Opens up a dialogue box for the user to enter some input.
forward()
Enables user to forward to next page in the browser's history list - just like using the browsers forward button.
blur()
When applied to a window, it removes focus from window ie. moves it behind others.
close()
Closes current or any other specified window.
confirm()
The confirm() Method brings up a dialog box with a message and asks a user to choose either OK or Cancel. Returns true or false respectively.
focus()
The Window focus() Object Method gives focus to a specified window ie. moves it in front of other windows.
home()
Same effect as pressing the home button on a browser ie. it takes the user to the page they set as their home page.
moveBy()
Moves the browser window by a specified horizontal and vertical offset in pixels.
moveTo()
Moves the browser window to a specified x and y coordinates.
print()
Prints out the contents of the current window.
stop()
Produces the same effect as clicking the stop button on your browser.
 |
|
|