Reply LinkBack Thread Tools Search this Thread
Old 22-08-2006, 09:21   #1 (permalink)
KrisMarissens
or just Kris
 
Join Date: Jun 2005
Location: Brussels - Belgium
Posts: 102
JS external link script (icw ASP .NET CMS generated site) not working for me

Hi all,

I'm currently trying to add a simple external link script to an ASP .NET CMS driven site, but i can't get it to work...

Code:
function externalLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName("a"); for (var i=0; i<anchors.length; i++) { var anchor = anchors[i]; var parent = anchors[i].parentNode; if (parent.className == "external"){ anchors[i].target = "_blank" } } } window.onload = externalLinks;


A lot of content in this site is generated using a CMS app. The links are generated using ASP .NET controls.

What i'm trying to do is: Get every <a> tag on the page and check if the parentNode contains a classname ("external").

I'm calling this function from within the <head> of the html pages (an include)...


Comments and advice much appreciated...

Last edited by KrisMarissens : 22-08-2006 at 16:55.
  Reply With Quote
Old 22-08-2006, 16:34   #2 (permalink)
KrisMarissens
or just Kris
 
Join Date: Jun 2005
Location: Brussels - Belgium
Posts: 102
On a simple static page it works just fine:

testpage here
  Reply With Quote
Old 23-08-2006, 06:27   #3 (permalink)
KrisMarissens
or just Kris
 
Join Date: Jun 2005
Location: Brussels - Belgium
Posts: 102
Working

To end this little self-discussion, everything is working fine now.
I can only assume there must have been some sort of caching issue...
  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