simulate to change the background color when click the link

Posted by tom on Stack Overflow See other posts from Stack Overflow or by tom
Published on 2010-05-22T07:37:55Z Indexed on 2010/05/22 7:40 UTC
Read the original article Hit count: 196

Filed under:
|
|
|

I have the following HTML and the java script below to simulate the background color change when the link block is clicked, but it doesn't seem to work. Any reason why?

If I have only the onmousedown event handled, the background color will be changed to blue for sure. But if both onmousedown and onmouseup are handled, nothing would change visually.

note...

function changeColorOnMouseDown() { document.getElementById('note').style.background='blue'; }

function changeColorOnMouseUp() { document.getElementById('note').style.background='#d8dde7'; }

© Stack Overflow or respective owner

Related posts about html

Related posts about onmousedown