IE does not like setAttribute onClick. I had a similar problem recently. I solved it by using the correct method first (as yours) then adding a function to deal with IE after it.
function onclickIE(idAttr,handler,call){ if ((document.all)&&(document.getElementById)){idAttr[handler]=new Function(call)} } Hope that helps mike 2k:)2 <marquee><blink> mike foskett </marquee></blink> [EMAIL PROTECTED] http://www.webSemantics.co.uk -----Original Message----- From: Justin French [mailto:[EMAIL PROTECTED] Sent: 19 August 2004 07:22 To: [EMAIL PROTECTED] Subject: [WSG] DOM setAttribute in IE? Here's a function: function helpLinks() { if(!document.getElementsByTagName) return; var anchors = document.getElementsByTagName("a"); for (var i=0; i<anchors.length; i++) { var anchor = anchors[i]; if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "help") { anchor.setAttribute( "onclick","window.open(this.href,'popupwindow','width=400,height=400,scr ollbars,resizable'); return false;",0); } } } It works perfectly well in everything I can get my hands on except for IE, where it fails to set the onclick event to all A elements with a rel attribute of 'help'. Changing anchor.setAttribute(...) to anchor.setAttribute('target','_blank',0); DOES work (the link opens in a new window), so it would appear that IE doesn't like setting onlick attributes this way. Can anyone either: - suggest an alternate way to achieve this, or - suggest a good mailing list to seek further help on (like a DOM list) --- Justin French http://indent.com.au ****************************************************** The discussion list for http://webstandardsgroup.org/ Proud presenters of Web Essentials 04 http://we04.com/ Web standards, accessibility, inspiration, knowledge To be held in Sydney, September 30 and October 1, 2004 See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help ****************************************************** ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ********************************************************************** ****************************************************** The discussion list for http://webstandardsgroup.org/ Proud presenters of Web Essentials 04 http://we04.com/ Web standards, accessibility, inspiration, knowledge To be held in Sydney, September 30 and October 1, 2004 See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help ******************************************************