culter
culter

Reputation: 5697

javascript IE bug

I have this web page where are two links at the bottom (aaa, bbb) which runs bumpbox(lightbox alternative). In Opera, FF, Chrome works javascript code which connect (binocular) icon on the map with these links, but not in IE. There are no problems in the console. I've tried IE7,8. Thank you for your help!

the funcion (I think the problem is with the /* for IE */ part):

function fireEvent(element, event){
if (document.createEventObject){
/* for IE */
return element.fireEvent('on' + event, document.createEventObject());
}else{
/* for other browsers */
var evt = document.createEvent('HTMLEvents');
evt.initEvent(event, true, true);
}
return !element.dispatchEvent(evt);
}


google.maps.event.addListener(pano01, 'click', function() {    
fireEvent(document.getElementById("c01").getElementsByTagName("a")[0], 'click');

Upvotes: 0

Views: 112

Answers (1)

epascarello
epascarello

Reputation: 207511

Try changing

return element.fireEvent('on' + event, document.createEventObject());

to

return element[event]();

It should work fine with click.

Upvotes: 2

Related Questions