budapestnori
Technical User
Hi Guys, I have a link in my page, which happens to have a class assigned to it. The class has a background and color specified. When clicked, I want to call a function called changecolor2 which will require one parameter. The parameter passed will be - this. I then want to take that link's class' background color, and assign it to another element, thus changing that classes background-color dynamically. Here is my code, but it does not seem to do anything.
My Function:
function changeColor2(xyz) {
var x;
x = document.getElementById(xyz).style.backgroundColor;
alert(x);
return;
}
My call to the function:
<a href="#" class="one" onClick="changeColor2(this);"><img src="images/bg_blank_button.gif"></a>
Thanks guys,
Budapest Nori
My Function:
function changeColor2(xyz) {
var x;
x = document.getElementById(xyz).style.backgroundColor;
alert(x);
return;
}
My call to the function:
<a href="#" class="one" onClick="changeColor2(this);"><img src="images/bg_blank_button.gif"></a>
Thanks guys,
Budapest Nori