ImageMap无法在android模拟器中运行

时间:2011-06-19 02:01:08

标签: android html webview imagemap

我使用多个图像和鼠标悬停功能创建了一个图像映射,它在descktop上正常工作。我只是加载了android中webview中创建的html的url,图像映射不起作用!! .. 请帮忙,因为我实际上被卡住了:(

<script language="javascript">

a1 = new Image(107,36);
a1.src = "a1.jpg";
a2 = new Image(107,36);
a2.src = "a2.jpg";
a3 = new Image(107,36);
a3.src = "a3.jpg";
a4 = new Image(107,36);
a4.src = "a4.jpg";

 //image swapping function:
function hiLite(imgDocID, imgObjName, comment) {

document.images[imgDocID].src = eval(imgObjName + ".src");
window.status = comment; return true;
}
//end hiding -->
</script>

<BODY>
<img src="a1.jpg" name="a"
style="border: none;" usemap="#shapes"/>
<map name="image" id="shapes">

<area   shape="poly"
coords="322,280,322,276,319,273,316,272,312,267,308,261,306,258,308,248,304,246,307,240,312,239,316,238,322,240,325,241,328,235,335,232,342,232,350,233,356,238,357,244,358,249,360,253,365,257,370,258,374,260,374,267,370,273,370,279,364,286,357,292,354,295,347,295,339,298,331,300,326,299"
href="javascript:clicked_on('triangle');"
title="Triangle" alt="Aryll" onMouseOver="hiLite('a','a2','Your Comment Here')" onMouseOut="hiLite('a','a1','')"/>
locater.print("Entering hiLite");
<area   shape="poly"
coords="281,217,296,216,302,217,311,211,310,201,317,199,321,191,330,193,337,189,333,174,333,164,344,159,358,161,360,154,351,147,349,137,376,139,399,136,405,137,418,147,419,167,401,192,400,201,404,212,393,223,390,238,385,250,375,259,361,253,358,248,355,235,341,231,329,233,324,240,312,238,304,245,294,242,292,238,275,235,279,226"
href="javascript:clicked_on('triangle');"
title="Triangle" alt="Aryll" onMouseOver="hiLite('a','a3','Your Comment Here')" onMouseOut="hiLite('a','a1','')"/>

<area   shape="poly"
coords="283,141,298,139,302,133,312,131,323,139,336,139,344,136,351,143,351,151,359,155,355,161,340,160,333,167,334,175,336,184,336,190,330,192,323,191,316,197,315,199,310,201,309,207,308,214,294,215,281,215,300,201,298,186,306,173,301,167,289,170,285,157,280,145"
href="javascript:clicked_on('triangle');"
title="Triangle" alt="Aryll" onMouseOver="hiLite('a','a4','Your Comment Here')" onMouseOut="hiLite('a','a1','')"/>

<area   shape="poly"
coords="266,340,269,336,270,331,276,331,278,333,288,332,290,335,286,336,284,348,283,344,279,346,278,348,271,346,266,341,266,338,270,337,270,331,275,330"
href="javascript:clicked_on('triangle');"
title="Triangle" alt="Aryll" onMouseOver="hiLite('a','a5','Your Comment Here')" onMouseOut="hiLite('a','a1','')"/>

  </map>
 </BODY>

 </HTML>

2 个答案:

答案 0 :(得分:1)

你在HTML代码中有错误。 attr usemap应该引用name

地图的id attr
<img src="a1.jpg" name="a" style="border: none;" usemap="#image"/>

答案 1 :(得分:0)

尝试使用WebView

http://developer.android.com/guide/webapps/webview.html

希望它会对你有所帮助。