on the ONClick event i want to be able to change the background color of one layer to be highlighted and reset the background colors of the other layers.
so only the layer that was most recently clicked has the highlighted color while all others are set back to the default color.
This works but it only affects the layer i am clicking on and it uses the change_prop behavior :
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById; return x;
}
function MM_changeProp(objName,x,theProp,theValue) { //v6.0
var obj = MM_findObj(objName);
if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
if (theValue == true || theValue == false)
eval("obj."+theProp+"="+theValue);
else eval("obj."+theProp+"='"+theValue+"'");
alert(objName);
alert(obj);
alert("obj."+theProp+"='"+theValue+"'");
}
}
BUT now i want to reset the other layers back to their org value and the following does not work ?
eval("[rightTopMenu.rItemTwo].style.backgroundColor='"+theValue+"'");
eval("rightTopMenu.rItemTwo.style.backgroundColor=#001111");
how do i reset the other layers without calling the FindObj function...shouldn't i be able to directly affect the layer in question by its name ???
I am not fond of this code, so if there is an easier script i would be interested in that as well.
so only the layer that was most recently clicked has the highlighted color while all others are set back to the default color.
This works but it only affects the layer i am clicking on and it uses the change_prop behavior :
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById; return x;
}
function MM_changeProp(objName,x,theProp,theValue) { //v6.0
var obj = MM_findObj(objName);
if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
if (theValue == true || theValue == false)
eval("obj."+theProp+"="+theValue);
else eval("obj."+theProp+"='"+theValue+"'");
alert(objName);
alert(obj);
alert("obj."+theProp+"='"+theValue+"'");
}
}
BUT now i want to reset the other layers back to their org value and the following does not work ?
eval("[rightTopMenu.rItemTwo].style.backgroundColor='"+theValue+"'");
eval("rightTopMenu.rItemTwo.style.backgroundColor=#001111");
how do i reset the other layers without calling the FindObj function...shouldn't i be able to directly affect the layer in question by its name ???
I am not fond of this code, so if there is an easier script i would be interested in that as well.