HTML DOM protocol 属性
JavaScript基础 2022-06-08 15:31:3214小码哥的IT人生shichen
HTML DOM protocol 属性
定义和用法
protocol 属性可设置或返回某个区域中 link-URL 的协议。
语法
areaObject.protocol=protocol
实例
下面的例子可返回 "Venus" 区域中 link-URL 的协议:
<html> <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>Venus' protocol: <script type="text/javascript"> x=document.getElementById('venus'); document.write(x.protocol
); </script> </p> </body> </html>
TIY
完整实例【取得图像地图中某个区域的 link-URL 所用的协议】:
<html> <body> <img src="/i/eg_planets.jpg" usemap="#planetmap" /> <map name="planetmap"> <area id="venus" shape="circle" coords="180,139,14" href ="/demo/example/html/venus.html" alt="Venus" /> </map> <p>Venus 的协议: <script type="text/javascript"> x=document.getElementById('venus'); document.write(x.protocol); </script> </p> </body> </html>
可以使用本站在线JavaScript测试工具测试上述代码运行效果:http://www.phpcodeweb.com/runjs.html