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 ******************************************************
