我有一个精灵,当点击它时,它应该打开一个htm帮助文件或视频,具体取决于点击的位置。
我已经尝试了asp.net图像映射和客户端映射,有和没有window.open,还发送到javascript函数。什么都行不通。
我真的不想使用服务器端,但我似乎无法使用它。
<div class="divhelp">
<br />
<asp:ImageMap
ID="ImageMap1"
runat="server"
ImageUrl="~/images2020/SpriteVideoandHelp.png"
Width="70"
Height="32"
HotSpotMode="NotSet">
<asp:RectangleHotSpot Target="_self" Top="0" Bottom="32" Left="0" Right="34" AlternateText="Videos" NavigateUrl="openVideoHelp('1')" />
<asp:RectangleHotSpot Target="_blank" Top="0" Bottom="32" Left="35" Right="70" AlternateText="Help" NavigateUrl="javascript:window.open('../HelpFiles/Login.htm', 'Search', 'width=600,height=450,left=150,top=200,scrollbars=1,toolbar=no,menubar=yes,status=1')" />
</asp:ImageMap>
</div>
<a href="#"><img src="images2020/SpriteVideoandHelp.png" alt="Videos and Help Files" width="70" height="32" border="0" usemap="#mapname"/></a><br />
<map id="mapname">
<area shape="rect" onclick="javascript:window.open('../HelpFiles/Login.htm','Search','width=650,height=500,left=150,top=200,scrollbars=1,toolbar=no,menubar=yes,status=1')" alt="Videos" coords="0,32,0,34"/>
<area shape="rect" onclick="javascript:window.open('../HelpFiles/Login.htm','Search','width=650,height=500,left=150,top=200,scrollbars=1,toolbar=no,menubar=yes,status=1')" alt="Help" coords="0,32,35,70" />
</map>
function openVideoHelp(imgClicked) {
if (imgClicked == '1') {
helpfile = window.open('../HelpFiles/Login.htm', 'Search', 'width=600,height=450,left=150,top=200,scrollbars=1,toolbar=no,menubar=yes,status=1');
return false;
}
else {
helpfile = window.open('../HelpFiles/Login.htm', 'Search', 'width=600,height=450,left=150,top=200,scrollbars=1,toolbar=no,menubar=yes,status=1');
return false;
};
};
上面还有其他一些变种,我试过没有运气。
我做错了什么或者这不可能?
感谢您的帮助。
答案 0 :(得分:0)
您可以删除服务器端图像映射。
客户端图像映射的所有问题是您已获得图像切换的宽度和高度。它应该是width="32" height="70"
。
此外,视频区域的坐标也是混乱的:它应该是<area coords="0,0,32,34"...
。
希望有所帮助。