map area-position:relative中的style属性在我的html应用程序中不起作用

map area-position:relative中的style属性在我的html应用程序中不起作用,html,asp.net,css,hta,Html,Asp.net,Css,Hta,在我的aspx文件中,我有img标签和地图标签 <IMG id="imgLogo" src="images/baner.jpg" usemap="#map"> <map name="map" style="display:block; position:relative;"> <area id="myArea" shape=poly coords="803, 1, 952, 1, 988, 108, 840, 112" href=MainNew.aspx

在我的aspx文件中,我有img标签和地图标签

<IMG id="imgLogo" src="images/baner.jpg" usemap="#map">
<map name="map" style="display:block; position:relative;">
    <area id="myArea"  shape=poly coords="803, 1, 952, 1, 988, 108, 840, 112" href=MainNew.aspx alt="this is a link!!"/>
</map>


当我以web应用程序的形式运行页面时,它可以正常工作,但当我以html应用程序的形式运行页面时,区域位置不是相对的,当我更改浏览器大小时,区域位置会移动。如何修复它?

我编写了解决问题的javascript函数, 该函数用于查找多边形点的相对位置:

 <body onload="function(){
     var height = document.getElementById('imgLogo').height;
     var width = document.getElementById('imgLogo').width;
     var relativeWidth = 0.147;
     var relativeTopStartPoint = 0.787;
     var relativeBottomStartPoint = 0.8235;
     var coords = Math.ceil(width * relativeTopStartPoint) + ',0 ,' + Math.ceil(width * relativeTopStartPoint + width * relativeWidth) + ',0 ,' + Math.ceil(width * var relativeBottomStartPoint + width * relativeWidth) + ',' + Math.ceil(height) + ' ,' + Math.ceil(width * var relativeBottomStartPoint) + ',' + Math.ceil(height);
            document.getElementById('myArea').setAttribute('coords', coords);}" >
...
</body>

...

如果从
map
中删除整个
style
属性,会发生什么<代码>地图应该不需要那种样式。没什么,它确实没有帮助,但问题仍然存在。我不明白。附加的(未定位的)
地图
位于
img
的左上角,在调整窗口大小时不会从该点移动任何位置,但是
img
本身会移动。使用HTA没有任何区别。您能详细说明一下您的问题吗?现在我看到在css文件中img大小发生了更改:#imgLogo{width:expression(document.body.offsetWidth-21+“px”);/*height:50px;*/}Hmm。。。我就是这么想的。。。我已经回答了这个问题。