if (navigator.appName == "Microsoft Internet Explorer") { element.attachEvent('onclick', myFunction); } else { element.addEventListener('click', myFunction, false); }