Enter a query to search our site. Note that you can use "*" and "?" as wildcards. Enclosing more than one word in double quotes ("CSS Layout") will search for the exact phrase.

Project Seven dot com
Search
 

PVII PowerToys

Add to Cart - $18

Apply Return False PowerToy

Adding a JavaScript return false directive is a useful technique to prevent the browser from actually executing or loading the linked page. This is commonly used when there is an onClick event to execute a JavaScript action (to show or hide a submenu or to pop up a new window). It allows the browser to execute the scripts without attempting to load the url specified in the href attribute of the hyperlink.

Return false is also used as an accessibility feature as it allows you to use an actual hyperlink on an <a> tag which also fires a JavaScript event. As an example, adding a return false to the onClick event of a link that triggers the visibility of a submenu (in a popup or otherwise hierarchical menu scenario) allows you to have that trigger link to an actual page. The return false prevents the page from being loaded if JavaScript is enabled, but will load the page if JavaScript is disabled (or unsupported).

The Apply Return False PowerToy allows you to quickly create or add the return false JavaScript code to your link by simply right-clicking (control-click on the Mac) and selecting Apply Return False from the context menu. The command will append an existing onClick event with a return false. If there is no existing onClick event it will create a new onClick event and apply the return false to it.

Note: The Apply Return False PowerToy is available in both Design View and Code View.

Apply Return False to an existing onClick event

-In Code View, or Design View, click on the link you to which you wish to apply the Return False

Hyperlink markup to which we will apply the Return False

-You can click anywhere inside the link - but do not select any text.

The link can be a text link or an image link.

-Right-click and select PVII PowerToys - Apply Return False

The Apply Return False menu flyout

A return false will be added to the onClick event of the hyperlink.

Hyperlink markup with Return False Fix applied

Applying Return False to a link that does not contain an onClick event

-In Code View, or Design View, click on the link you to which you wish to apply the Return False

Image button to which we will apply a return false

This example is in Design View, using a button image trigger. The <a> tag markup contains onMouseOver and onMouseOut events - but does not contain an onClick event:

<a href="#" onMouseOver="P7_trigNV('p7NVim2')" onMouseOut="P7_trigNV()"><img src...</a>

-Select the image

-Right-click and select PVII PowerToys - Apply Return False

Apply Retrun False menu flyout

An onClick event will be added to the hyperlink, with the return false applied. The <a> tag markup will now look like this:

<a href="#" onClick="return false" onMouseOver="P7_trigNV('p7NVim2')" onMouseOut="P7_trigNV()"><img src...</a>

User Notes

Undo -You can reverse the PowerToy insertion by using the Dreamweaver Undo feature (Edit - Undo). This will restore your markup to the state prior to the PowerToy insertion.

Add to Cart - $18

See More PowerToys Features