Javascript examples for DOM Event:onclick
Click on a <p> element to change its text color to red:
<!DOCTYPE html> <html> <body> <p id="demo" onclick="myFunction()">Click me to change my text color.</p> <script> function myFunction() {// ww w .j ava2s.c o m document.getElementById("demo").style.color = "red"; } </script> </body> </html>