Old 14-10-2006, 11:51   #1 (permalink)
chris_bcn
Goodbye little old lady
 
chris_bcn's Avatar
 
Join Date: Jun 2005
Location: Geordie in SF
Posts: 340
Send a message via MSN to chris_bcn
Popup JS not working in IE

I have to create some popups - yes they have to be popups, and no I can't use lightbox

I have this script

window.onload = function() {
// check to see that the browser supports the getElementsByTagName method
// if not, exit the loop
if (!document.getElementsByTagName) {
return false;
}
// create an array of objects of each link in the document
var popuplinks = document.getElementsByTagName("a");
// loop through each of these links (anchor tags)
for (var i=0; i < popuplinks.length; i++) {
// if the link has a class of "popup"...
if (popuplinks[i].className == "popup") {
// add an onclick event on the fly to pass the href attribute
// of the link to our second function, openPopUp
popuplinks[i].onclick = function() {
openPopUp(this.getAttribute("href"));
return false;
}
}
}
}

function openPopUp(linkURL) {
window.open(linkURL,'popup','width=760,height=600' )
}

and it works fine in FF - but IE doesn't like it. any idea why?
  Reply With Quote
Old 14-10-2006, 12:20   #2 (permalink)
SeanMedia
Senior Member
 
SeanMedia's Avatar
 
Join Date: Jun 2003
Location: Belfast, Ireland
Posts: 416
Send a message via MSN to SeanMedia Send a message via Skype™ to SeanMedia
what version of IE are ya using? recent versions have a popup blocker - that could be it.
  Reply With Quote
Old 14-10-2006, 12:56   #3 (permalink)
chris_bcn
Goodbye little old lady
 
chris_bcn's Avatar
 
Join Date: Jun 2005
Location: Geordie in SF
Posts: 340
Send a message via MSN to chris_bcn
no that's not it unfortunately - in fact nothing appears on click in IE. fine in FF and safari though
  Reply With Quote
Old 14-10-2006, 13:27   #4 (permalink)
freelancr
Senior Member
 
freelancr's Avatar
 
Join Date: Oct 2006
Posts: 2,195
code looks like it should work, are you able to test it on another machine as D*D had a problem only happening on his development machine with javascript. Using another machine revealed it worked fine.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8