HTML area target 属性
htmlweb developmentfront end technology更新于 2025/3/20 14:36:17
<area> 元素的 target 属性允许您设置链接文档的打开位置,例如,新窗口、同一框架、父框架等。
以下是语法 −
<area target="_blank|_self|_parent|_top| frame">
其中, _blank 用于在新窗口或选项卡中打开链接文档,_self 用于在被点击的同一框架中打开链接文档,_parent 用于在父框架中打开文档,_top 用于在整个窗口主体中打开链接文档,frame 用于在指定的框架中打开链接文档。
现在让我们看一个实现 <area> 元素 target 属性的示例。元素 −
示例
<!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>
上面我们设置了以下方式在新窗口中打开链接文档,即_blank,用于在新窗口或选项卡中打开链接文档
target = "_blank"
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

