I am trying to change the background color of all cells[8] by clicking a ‘Print Your Order’ link at the bottom of the table container div. The target or srcElement is the link and dosen’t ascend the ‘td’ of every rows cells[8] collection in the Dom Tree so ascendDOM isn’t working. I know there’s away of chaning the class of all ‘tds’ /cells[8] from className=clear to className=check and it’s a form of (target,classValue) match regExpresion but ‘target’ seems all wrong as the link is the target that I want to add an ‘onclick’ event to that changes the ‘tds’ from one class to another? Any pointers in the right direction would be greatly appreciated.:sick:
Wow, overtierd, came up with this that works and is a lot easier than any Ideas I had about the ‘ascendDOM’ technique I was erronieslly trying to use.
function changeclear() {
var e = document.getElementsByClassName('clear');
for ( var i=0, len=e.length; i<len; ++i ){
e[i].className = 'check';
e[i].innerHTML='[ ]';
}
}
var printorder=document.getElementById('printorder');
var clear=document.getElementsByClassName('clear');
addEvent(printorder,'click',function(){
document.getElementById('dumy').style.display='none';
document.getElementById('headclear').innerHTML='Check';
document.getElementById('headclear').style.paddingRight='8px';
changeclear();
},false);
Wierd Science Javascript! You learn something new and forget everything else? Forgot my ‘For’ constructor technique for grabing all the elements of that class!