JavaScript Tutorial/HTML Tags/Area

Материал из Web эксперт
Перейти к: навигация, поиск

Area

An instance of the Area object is created with each occurrence of the <area> tag within an HTML document.

In HTML documents, the <area> tag is used in conjunction with the <map> tag to define an area within a picture that will act as a hyperlink.

Because the Area object is a hyperlink, it is equivalent to the Link object in JavaScript.

The Area object is stored in the same array where Link objects are stored.

Properties/Methods/Event Handlers Description hash The portion of the URL that is the anchor, including the # symbol host The hostname (IP address) and port specified in the URL hostname The hostname specified within the URL href The entire URL pathname The path of the file specified in the URL beginning with the / symbol port The port specified in the URL protocol The protocol specified in the URL, including the ending colon (:) search The search part of the URL, including the beginning question mark (?) target The name of the target window in which the URL should be displayed handleEvent() Calls the event handler associated with this event onDblClick Invoked when the mouse is double-clicked while in the region defined by the Area object onMouseOut Invoked when the mouse moves outside the region defined by the Area object onMouseOver Invoked when the mouse moves into the region defined by the Area object



   <source lang="javascript">

<html>

   <body>
   <map name="colorMap">
     <area name="redArea"
           coords="1,1,48,48"
           href="http://www.wbex.ru"
           target="_top"
           onMouseOver="overBox(0)"
           onMouseOut="clearBox()">
     <area name="greenArea"
           coords="51,1,99,49"
           href="http://www.wbex.ru"
           target="_top"
           onMouseOver="overBox(1)"
           onMouseOut="clearBox()">
     <area name="yellowArea"
           coords="1,51,51,99"
           href="http://www.wbex.ru"
           target="_top"
           onMouseOver="overBox(2)"
           onMouseOut="clearBox()">
     <area name="blueArea"
           coords="51,51,99,99"
           href="http://www.wbex.ru"
           target="_top"
           onMouseOver="overBox(3)"
           onMouseOut="clearBox()">
   </map>
   <img src="http://www.wbex.ru/style/logo.png" align="top"
        height="100"   width="100" usemap="#colorMap">
   

AREA Properties <form name="myForm"> hash=<input name="tHash" type="textarea">
host=<input name="tHost" type="textarea">
hostname=<input name="tHostName" type="textarea">
href=<input name="tHref" type="textarea">
pathname<input name="tPathName" type="textarea">
port=<input name="tPort" type="textarea">
protocol=<input name="tProtocol" type="textarea">
search=<input name="tSearch" type="textarea">
target=<input name="tTarget" type="textarea">
</form> <script language="javascript"> </script> </body> </html></source>

Area.handleEvent()

Syntax



   <source lang="javascript">

document.links[num].handleEvent(event)</source>


Area.host

Syntax



   <source lang="javascript">

document.links[num].host</source>


Area.hostname

Syntax



   <source lang="javascript">

document.links[num].hostname</source>


Area.href

Syntax



   <source lang="javascript">

document.links[num].href</source>


Area.onDblClick

Syntax



   <source lang="javascript">

onDblClick="command"</source>


Area.onMouseOut

Syntax



   <source lang="javascript">

onMouseOut="command"</source>


Area.onMouseOver

Syntax



   <source lang="javascript">

onMouseOver="command"</source>


Area.pathname

Syntax



   <source lang="javascript">

document.links[num].pathname</source>


Area.port

Syntax



   <source lang="javascript">

document.links[num].port</source>


Area.protocol

Syntax



   <source lang="javascript">

document.links[num].protocol</source>


Area.search

Syntax



   <source lang="javascript">

document.links[num].search</source>


Area.target

Syntax



   <source lang="javascript">

document.links[num].target</source>