JavaScript Menu
Home
Examples of different messages that can be generated to the user and the ways to incorporate them into the HTML.
- "window.alert()" code embedded into the tag
- calls a separate method that generates the message by using "window.alert()" method
Click Me - call to "window.alert()" embedded into the tag; "return false" is also embedded so that the user is not actually transferred to where the link is pointing.
- brings up a prompt to enter a day; the information entered is then displayed to the user
No link - this time the prompt is triggered by the link, but the links does not have a "link" property. Instead of a URL we specify a method to call like this: "javascript: enterDay()".
Transfer Me - brings up a confirmation window and if the user says "ok", he/she is transferred to another site, if clicks "Cancel", the transfer is aborted. Function confirmTransfer() returns either true or false depending on the input. The return value determines whether the transfer is carried out or not.
Yahoo Infoseek - this is an example of showing messages in the status bar. The messages are triggers by "mouseOver" event. Put the mouse over the links and watch the message bar.