View Single Post
Old 01-28-2010, 01:38 AM   PM User | #2
bdl
Regular Coder

 
Join Date: Apr 2007
Location: Camarillo, CA US
Posts: 590
Thanks: 4
Thanked 83 Times in 82 Posts
bdl is an unknown quantity at this point
Welcome to the forums. Please be mindful to use the CODE tags and indent for readability when posting code.

What you can do is run through each link in the for loop and test for a class as you go, e.g.
Code:
  window.onload = function () {
    var links= document.getElementsByTagName('a');
    for (var i = 0, l= links.length; i<l; i++) {
        if ( links[i].className == 'changelink' ) {
            links[i].href += '&layout=jp';
        }
    }
  };
I've altered it slightly, using a DOM method to get all the anchor tag elements, then checking each one for a specific className. The loop is slightly different as well, assigning the links length value once rather than evaluating it on each iteration.
bdl is offline   Reply With Quote
Users who have thanked bdl for this post:
phellyer (02-01-2010)