Forum Moderators: open
hope you got what I want and what I meant
thx in advance
<script type="text/javascript">
<!--
function ChangeBackground(element,act) {
//alert(element.flag);
if (act == 'click') {
if (element.flag!= 'clicked') {
element.flag = 'clicked';
element.style.backgroundColor = '#CC99CC';
} else {
element.flag = '';
element.style.backgroundColor = '#999999';
}
}
if (act == 'out') {
if (element.flag!= 'clicked') {
element.style.backgroundColor = '#FFFFFF';
} else {
element.style.backgroundColor = '#CC99CC';
}
}
if (act == 'over') {
if (element.flag!= 'clicked') {
element.style.backgroundColor = '#999999';
} else {
element.style.backgroundColor = '#CC99CC';
}
}
}
-->
</script>
<table border="1" cellpadding="5">
<tr onmouseover="ChangeBackground(this,'over');" onmouseout="ChangeBackground(this,'out');" onclick="ChangeBackground(this,'click');">
<td>Example Cell 1</td>
<td>Example Cell 1</td>
<td>Example Cell 1</td>
</tr>
</table>
Can anyone clean up this code? I've still not got the hang of the shorthand logic expressions. :(