
定义和用法
href 属性克设置或返回某区域href属性的值。
href 属性指定了某个区域的目标链接。
语法
areaObject.href=URL
浏览器支持
所有主要浏览器都支持 href 属性
实例
实例
下面的例子可返回图像映射中 "Venus" 区域的href属性:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>CPU中文网-教程(gongju88.com)</title> </head> <body> <img src="planets.gif" width="145" height="126" usemap="#planetmap"> <map name="planetmap"> <area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm"> </map> <p>金星的href属性值: <script> document.write(document.getElementById("venus").href); </script> </p> </body> </html>
以上实例输出结果:
金星的href属性值: /try/demo_source/venus.htm
