我有一个精灵,单击时应打开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;
    };

};


以上是我尝试过的其他几种变体,没有运气。

我在做什么错或这是不可能的?

谢谢您的帮助。

最佳答案

您可以删除服务器端图像映射。

客户端图像映射的所有错误之处在于,您已经获得了切换图像的宽度和高度。它应该是width="32" height="70"

另外,视频区域的坐标混合了:应该显示为<area coords="0,0,32,34"...

希望能有所帮助。

10-04 22:34
查看更多