The Small
class represents an HTML <small> element.
The Small object supports the standard properties and events.
The following code shows how to get a <small> element by using getElementById().
<!DOCTYPE html>
<html>
<body>
<small id="mySmall">small</small>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!-- w w w . j a v a2s .c o m-->
var x = document.getElementById("mySmall");
x.style.color= "blue";
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to create a <small> element by using the document.createElement() method.
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!-- www . j a va2 s . co m-->
var x = document.createElement("SMALL");
var t = document.createTextNode("small");
x.appendChild(t);
document.body.appendChild(x);
}
</script>
</body>
</html>
The code above is rendered as follows: