Javascript examples for DOM HTML Element:Italic
The Italic object represents an HTML <i> element.
You can access an <i> element by using getElementById():
<!DOCTYPE html> <html> <body> <i id="myItalic">this italic text</i> <button onclick="myFunction()">set the color</button> <script> function myFunction() {//from www . java 2s . c o m var x = document.getElementById("myItalic"); x.style.color = "red"; } </script> </body> </html>