Assignment #5
My assignment is to get an alert box to pop up, when the cursor rolls across a hypertext link. This pop up window is a small dialog box, with the text written above an OK button. The new method is alert() and the format is: alert('text which appears in alert box')
This is how I composed my script:
-
I know I need the standard link code.
- Then the onMouseOver command. If this command is to make the alert occur, then that must be what the onMouseOver should equal.
- Now I add the alert() method, which I found works on both document and window objects.
- However, I have a problem: I cannot click on the link itself, because the alert pop up is in the way. Even if I move it out of the way, I still have to click on the OK button in the alert box before I can get back to the page where the link is. A new alert box pops up every time I attempt to click on the link.
- Now what? What happens if I put return true back in? Hmmm. Same thing. I don't need that.
- What happens if I remove the object? Same thing. Looks like I don't need the object either.
- I can't click on the link -- how can I make the alert box pop only once? Would a second onMouseOver command work? Yikes! No alert pop up window at all. Bye-bye, second command...
- I give up!
HTML file: |
Displayed by browser: |
<body>
<A HREF="http://www.dncsite.ca" target="_blank"
onMouseOver="alert('Here is a webpage of poetry books!');">
Click Here</A>
</body>
|
Click Here
|