I have a sprite that when clicked it should open either an htm help file or video, depending on where clicked.
I have tried asp.net image map and client side map, with and without the window.open and also sending to a javascript function. Nothing works. I really don't want to use server side, but I just can't seem to get this working.
<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;
};
};
There are several other variations to the above that I have tried with no luck.
What am I doing wrong or is this not possible?
Thank you for your help.
You can remove the server-side imagemap.
All that is wrong with the client-side imagemap is that you have got the width and height for the image switched. It should be width="32" height="70"
.
Also, the video area has it's co-ordinates mixed up: it should read <area coords="0,0,32,34"...
.
Hope that helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.