开发者

How to make IE fireevent on Client Side Image Map

开发者 https://www.devze.com 2022-12-15 08:40 出处:网络
I need to simulate a mouse click using IE on a client side image map. Which object should invoke the fireEvent()? It cannot be simply the <area> object since it could be referenced by 2 differen

I need to simulate a mouse click using IE on a client side image map. Which object should invoke the fireEvent()? It cannot be simply the <area> object since it could be referenced by 2 different <img>s. It cannot be the <img> since we need a way to tell which part of the img is clicked which is defined in the <area> tag?

I've done some test with real mouse click on an client side image map. The event object generated from my click indicates (by the event.srcElemen开发者_如何学运维t property) the event is generated from <area> tag. But when I tried to programmatically call the <area>'s fireEvent(), nothing happened!


This may be what you're looking for:

<img name="Area" src="Area.jpg" width="240" height="160" border="0" id="Area" usemap="#m_Area" alt="" /><map name="m_Area" id="m_Area">
<area shape="rect" id="A" coords="126,0,240,160" href="javascript:;" onclick="alert('a')" alt="" />
<area shape="rect" id="B" coords="0,0,126,160" href="javascript:;" onclick="alert('b')" alt="" />
</map>
<a href="javascript:document.getElementById('A').onclick()">Test</a>
0

精彩评论

暂无评论...
验证码 换一张
取 消