HTMLhref 属性
HTML <area> 元素的 href 属性设置了超链接目标。以下是语法 −
<area href="URL">
上方,URL 是您需要为区域指定的超链接,该区域可以是相对链接、绝对链接、脚本、协议等。
现在我们将了解一个示例来实现 HTML <area> 元素的 href 属性 −
示例
<!DOCTYPE html> <html> <body> <h2>Learning</h2> <p>Learn these technologies with ease....</p> <img src = /images/usemap.gif alt = "usemap" border = "0" usemap = "#tutorials"/> <map name = "tutorials"> <area shape = "poly" coords = "74,0,113,29,98,72,52,72,38,27" href = "/perl/index.htm" alt = "Perl Tutorial" target = "_blank" /> <area shape = "rect" coords = "22,83,126,125" alt = "HTML Tutorial" href = "/html/index.htm" target = "_blank" /> <area shape = "circle" coords = "73,168,32" alt = "PHP Tutorial" href = "/php/index.htm" target = "_blank" /> </map> </body> </html>
输出

在上面的示例中,我们已经设置了以下图像上的地图 −
<img src = /images/usemap.gif alt = "usemap" border = "0" usemap = "#tutorials"/>
现在,我们已对该地图及其中区域进行设置,以使之具有形状 −
<map name = "tutorials"> <area shape = "poly" coords = "74,0,113,29,98,72,52,72,38,27" href = "/perl/index.htm" alt = "Perl Tutorial" target = "_blank" /> <area shape = "rect" coords = "22,83,126,125" alt = "HTML Tutorial" href = "/html/index.htm" target = "_blank" /> <area shape = "circle" coords = "73,168,32" alt = "PHP Tutorial" href = "/php/index.htm" target = "_blank" /> </map>
以上区域的超链接是使用 href 属性进行设置的 −
href = "/php/index.htm
广告
数据结构
网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 语言
C++
C#
MongoDB
MySQL
Javascript
PHP