You are here: Reference > JavaScript > client-side > HTML DOM > properties > noHref (area)

noHref property (area)

Browser support:
Sets or retrieves whether an area is a link.
The noHref is only an informational property for the author, indicating that a region has no associated link. It is simpler not to specify the href property.
The noHref property always returns false in Internet Explorer, until its value is set from JavaScript.

Syntax:

object.noHref;
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: NOHREF

Possible values:

Boolean that indicates whether to click on the area causes some action.
One of the following values:
false
Default. Area is a link.
true
Area is not a link.
Default: false.

Example HTML code 1:

This example illustrates the use of the NOHREF attribute:
<img src="area.gif" width="504px" height="126px" border="0px" alt="Solar System" usemap="#SampleMap" />
<map name="SampleMap">
    <area shape="rect" coords="1,-1,83,125" alt="rectangle" nohref="nohref">
    <area shape="circle" coords="234,57,30" alt="circle" href="#">
    <area shape="poly" coords="363,37,380,40,399,35,420,47,426,63,423,78,430,94,409,90,395,92,379,84,371,67,370,57" alt="polygon" href="#">
</map>
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the noHref property:
<head>
    <script type="text/javascript">
        function SwitchToNoHref () {
            var map = document.getElementsByName ("SampleMap")[0];
            var areas = map.areas;
            for (var i = 0; i < areas.length; i++) {
                alert ("The nohref value of area "  + (i + 1) +  " is: " + areas[i].noHref);
            }
        }
    </script>
</head>
<body>
    <img src="area.gif" width="504px" height="126px" border="0px" alt="Solar System" usemap="#SampleMap" />
    <map name="SampleMap">
        <area shape="rect" coords="1,1,83,125" alt="rectangle" nohref="nohref">
        <area shape="circle" coords="234,57,30" alt="circle" href="#">
        <area shape="poly" coords="363,37,380,40,399,35,420,47,426,63,423,78,430,94,409,90,395,92,379,84,371,67,370,57" alt="polygon" href="#">
    </map>

    <button onclick="SwitchToNoHref ();">Get which area has no associated link!</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content