I have some text and a button. Once user clicks a button I want the text's background to change color to green and back. But nothing happens if I click the button...
Here's the JS script:
<script>
function bright(){
kontakt = document.getElementById('kontakt');
kontakt.bgcolor = '#A5DF00';
}
function dark(){
kontakt = document.getElementById('kontakt');
kontakt.bgcolor = '#000000';
}
function highlight(){
setTimeout(bright() , 1000);
setTimeout(dark() , 1000);
}
</script>
I call the highlight() from the button's onclick attribute like this: onclick='highlight()'
.
The text with id kontakt is always on the page.
Any clue?