On click event
onClick sets a script to run when the user clicks on the link. For example, this link creates an alert box which says Heading Home! when the link is clicked:
a href="mypage.oc.html" onclick="alert('Heading Home!')">My Page
One of the more useful uses of onClick is creating a popup window which the links targets. This example uses our popup window script
a href="mypage.popup.html" onclick="return openWindow(this,'mypage')">My Page
If onClick returns a value of false then the click is cancelled and the browser doesn't go anywhere. For example, you could check if a user really wanted to go to a URL like this:
a href="deleted.oc.html" onclick="return confirm('Are you SURE you want to delete this record?')">Delete It!
0 Comments:
Post a Comment
<< Home