查找区域的 target 属性的值
- <!DOCTYPE html>
- <html>
- <body>
- <img src ="/i/eg_planets.jpg"
- alt="Planets"
- usemap ="#planetmap" />
- <map name ="planetmap">
- <area shape ="circle" coords ="180,139,14"
- href ="/example/hdom/venus.html" id="venus"
- target="_self"/>
- </map>
- <p>单击按钮可返回图像映射中“venus”区域的 target 属性值。</p>
- <button onclick="myFunction()">试一试</button>
- <p id="demo"></p>
- <script>
- function myFunction() {
- var x = document.getElementById("venus").target;
- document.getElementById("demo").innerHTML = x;
- }
- </script>
- </body>
- </html>