fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> </head> <body> <img src="planets.gif" width="145" height="126" usemap="#myMap"> <p>点击按钮创建 IMAGE-MAP 和 AREA 元素并链接到 "venus.htm".</p> <p id="demo"></p> <button onclick="myFunction()">点我</button> <script> function myFunction(){ var x = document.createElement("MAP"); x.setAttribute("id", "myMap"); x.setAttribute("name", "myMap"); document.body.appendChild(x); var y = document.createElement("AREA"); y.setAttribute("href", "venus.htm"); y.setAttribute("shape", "circle"); y.setAttribute("coords", "124,58,8"); document.getElementById("myMap").appendChild(y); document.getElementById("demo").innerHTML = " MAP 已创建,你可以点击图片中的金星区域。"; } </script> </body> </html>
运行结果