J
julian_m
Incredibly, this function works as expected in IE (changing the
div_id's color after every click) , whereas it only changes div_id's
color once
function colorDiv(div_id)
{
if (document.getElementById(div_id).style.backgroundColor ==
'#00cc00'){
document.getElementById(div_id).style.backgroundColor = '#00cccc';
}else{
document.getElementById(div_id).style.backgroundColor = '#00cc00';
}
}
I call the above function this way:
<div id="div_1" onclick="colorDiv('div_1'); return false;" >
<div id="div_2" onclick="colorDiv('div_2'); return false;" >
<div id="div_3" onclick="colorDiv('div_3'); return false;" >
What's wrong with that?
reagards - julian
div_id's color after every click) , whereas it only changes div_id's
color once
function colorDiv(div_id)
{
if (document.getElementById(div_id).style.backgroundColor ==
'#00cc00'){
document.getElementById(div_id).style.backgroundColor = '#00cccc';
}else{
document.getElementById(div_id).style.backgroundColor = '#00cc00';
}
}
I call the above function this way:
<div id="div_1" onclick="colorDiv('div_1'); return false;" >
<div id="div_2" onclick="colorDiv('div_2'); return false;" >
<div id="div_3" onclick="colorDiv('div_3'); return false;" >
What's wrong with that?
reagards - julian