A demonstration of possible values: - Javascript CSS Style Property

Javascript examples for CSS Style Property:fontFamily

Description

A demonstration of possible values:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="myP">This is a paragraph.</p>

<select onchange="myFunction(this);" size="13">
  <option>Arial Black</option>
  <option>Arial</option>
  <option>Book Antiqua</option>
  <option>Courier New</option>
  <option>Georgia</option>
  <option>Helvetica</option>
  <option>Impact</option>
  <option>Lucida Console</option>
  <option>Lucida Sans Unicode</option>
  <option>Palatino Linotype</option>
  <option>Tahoma</option>
  <option>Times New Roman</option>
  <option>Verdana</option>

</select>//from  ww w  . j a  va  2 s. c  om

<script>
function myFunction(selectTag) {
    var listValue = selectTag.options[selectTag.selectedIndex].text;
    document.getElementById("myP").style.fontFamily = listValue;
}
</script>

</body>
</html>

Related Tutorials