zkac054
10-01-2006, 01:08 PM
Hi all,
I've recently found out that you can change an element's class using Javascript and thought I'd try it out. Here's the Javascript code I used which is called on an onMouseOver event:
var testArray=Array(), d=document;
function init(){
index=0;
num=d.getElementsByTagName("span");
for(i=0;i<num.length;i++){
if(num[i].id=("test")){
testArray[index]=num[i];
index++;
}
}
}
// onMouseOver
function show(i){
for(x=0; x<testArray.length; x++){
if(x == i){
testArray[x].className="normal";
}
else{
testArray[x].className="hideMe";
}
}
}
which is all well and works a treat with FireFox, but when I tried it out in IE (ver6) it didnt work. I've spent ages trying to figure out why, but I dont know why it doesnt work with IE. Does anyone have any ideas?
I've recently found out that you can change an element's class using Javascript and thought I'd try it out. Here's the Javascript code I used which is called on an onMouseOver event:
var testArray=Array(), d=document;
function init(){
index=0;
num=d.getElementsByTagName("span");
for(i=0;i<num.length;i++){
if(num[i].id=("test")){
testArray[index]=num[i];
index++;
}
}
}
// onMouseOver
function show(i){
for(x=0; x<testArray.length; x++){
if(x == i){
testArray[x].className="normal";
}
else{
testArray[x].className="hideMe";
}
}
}
which is all well and works a treat with FireFox, but when I tried it out in IE (ver6) it didnt work. I've spent ages trying to figure out why, but I dont know why it doesnt work with IE. Does anyone have any ideas?