Navigator 2.0, Internet Explorer 3.0; enhanced in Navigator 3.0
<A onClick="handler-statements"> a definition of the handler <AREA onClick="handler-statements"> another definition; Navigator 3.0 only link.onclick a reference to the handler link.onclick(); an explicit invocation of the handler
onclick() is an event-handler function invoked when the user clicks on a hypertext link. This event handler is defined by the onClick attribute of the HTML <A> or <AREA> tag that defines the hypertext link. The value of this attribute may be any number of JavaScript statements, separated by semicolons. These statements will be executed when the user clicks on the link.
The onclick() event handler is invoked before the browser follows the clicked hypertext link. This allows you to set the href, target, and other properties of the link dynamically (using the this keyword to refer to the clicked link). You may also use Window.alert(), Window.confirm(), and Window.prompt() from this event handler.
In Navigator 3.0, you may prevent the browser from following the link by returning false. If you return true, or any other value, or nothing, then the browser will follow the link as soon as onclick() returns. You might stop the browser from following a link if you used the Window.confirm() method to ask the user if they really want to follow the link and they choose the Cancel button, for example. In general, if you want a link that performs some action but does not cause a new URL to be displayed, it is better to use a the onclick() event handler of a Button object instead of the onclick() handler of a Link object.
Note that while this event handler returns false to tell the browser not to perform its default action (following a link), the onmouseover() event handler must return true to tell the browser not to take its default action (displaying the URL of the link). This incompatibility exists for historical reasons. The standard for Form and form element event handlers is to return false to prevent the browser from performing a default action.
In Navigator 3.0, the onclick() event handler of the <AREA> does not work on Windows platforms. Because this is a very common platform, you should avoid using this event handler in client-side image maps. Instead, you can often specify a javascript: URL as the value of the HREF attribute of the <AREA> tag.
file: /Techref/language/java/script/definitive/refp_199.htm, 6KB, , updated: 2019/10/14 15:00, local time: 2024/11/23 10:03,
18.118.227.199:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/Techref/language/java/script/definitive/refp_199.htm"> [Chapter 21] Reference: Link.onclick()</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.