Change element textDecoration: underline, none, overline in JavaScript

Description

The following code shows how to change element textDecoration: underline, none, overline.

Example


<html>
<head>
<script language="JavaScript">
  function addunderline() {<!--from   ww  w.  ja va 2 s .c  o m-->
    head1.style.textDecoration = "underline"
  }
  function removeunderline() {
    head1.style.textDecoration = "none"
  }
  function addoverline() {
    head1.style.textDecoration = "overline"
  }
</script>
</head>
<body>
  <h1 id="head1" onMouseover="addunderline()"
    onMouseout="removeunderline()" onClick="addoverline()">Welcome to
    this page!</h1>
  <P>A lot of interesting text goes here!</p>
</body>
</html>

Click to view the demo





















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window