Set text transform in Javascript

Description

The following code shows how to set text transform in Javascript.

Example


<html>
<head>
<script type="text/javascript">
  function bigger() {<!--from w w w  .j a  v a2s .c  o m-->
    var div = document.getElementById("div1");
    div.style.textTransform = "uppercase";
  }

  function smaller() {
    var div = document.getElementById("div1");
    div.style.textTransform = "none";
  }
</script>

</head>
<body>
  <a href="javascript:bigger();">bigger</a>
  <a href="javascript:smaller();">smaller</a>
  <div id="div1">
    <p>p1</p>
    <p>p2</p>
  </div>
</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