Now that I think about the situation more, you would be more accurate to say that the user is opening a popup (which some people find annoying) rather than leaving the website. After all, they will still have your website open but not in front.
EDIT: Sorry, I forgot about the IE error. What is the error's information?
This is a more compact, maintainable, and accessible way to do the same thing:
Code:
window.onload = function()
{
var vendorLinks = document.getElementsByName('vendorlnk');
for(var i = 0; i < vendorLinks.length; i++)
{
vendorLinks[i].onclick = vendorLink;
}
function vendorLink()
{
if(confirm("You are about to leave the website. Click OK to continue"))
window.open(this.href);
return false;
}
};
HTML Code:
<img src="images/vendors.jpg" width="516" height="606" usemap="#Map" />
<map name="Map" id="Map">
<area shape="rect" coords="25,497,125,466" href="http://www.company1.com/" name="vendorlnk" />
<area shape="rect" coords="15,235,133,387" href="http://www.company2.com/" name="vendorlnk" />
</map>
Bookmarks