JavaScript Reference/Javascript Properties/shape

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

"shape" Example

   <source lang="javascript">
   

<html> <head> <script language="JavaScript">

   function function1() {
       document.all.area1.coords = "0, 0, 100, 50";
   }
   function function2() {
       document.all.area2.coords = "100, 0, 200, 50"; 
       document.all.area2.noHref = "true";
   }
   function function5() {
       document.getElementById("area1").coords = "0, 0, 0, 0";
       document.getElementById("area2").coords = "0, 0, 0, 0";
   }

</script> </head> <body> <img src="yourimage.gif" id="myImg" alt="" width="200" height="100" usemap="#myMap2"> <map name="myMap2">

   <area id="area1" 
         shape="rect" 
         href="http://www.wbex.ru" 
         alt="wbex.ru" 
         onClick="return false">
   <area id="area2" 
         shape="rect" 
         href="http://www.wbex.ru" nohref="true" 
         alt="wbex.ru home page" 
         onClick="return false">

</map>
<input type="button" value="Make area 1 active" onClick="function1();"> <input type="button" value="Make area 2 active" onClick="function2();"> <button onclick="function5();">Restore areas to inactive</button> <button onclick="alert(myImg.isMap);">IS MAP</button> <button onclick="alert(area2.noHref);">noHref for Area 2</button> </body> </html>


     </source>
   
  


"shape" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |<a> <area> | +----------------+--------------------------------------------------------------+

     </source>
   
  


"shape" Possible Values

   <source lang="javascript">

Possible Values circ, circle, rect, rectangle, poly, polygon.


     </source>
   
  


"shape" Syntax and Note

   <source lang="javascript">

Note: Read and write property. Specifies the element shape.

Syntax:

document.getElementById("elementID").shape = value document.all.elementID.shape = value // IE only


     </source>