w3school event handling in java code example Example: javascript events list with examples function fun2 (myElement){ myElement.style.backgroundColor="#ccc"; }