Javascript DOM CSS Style listStyleType Property for all styles

Introduction

All the different list style types:

View in separate window

<!DOCTYPE html>
<html>
<body>

<ol id="myList">
  <li>CSS</li>
  <li>HTML</li>
  <li>SQL</li>
  <li>C++</li>
</ol>/*from  w  w  w. ja  va2s  . co m*/
<br>

<select onchange="myFunction(this);" size="22">
  <option>armenian</option>
  <option>circle</option>
  <option>cjk-ideographic</option>
  <option>decimal</option>
  <option>decimal-leading-zero</option>
  <option>disc</option>
  <option>georgian</option>
  <option>hebrew</option>
  <option>hiragana</option>
  <option>hiragana-iroha</option>
  <option>inherit</option>
  <option>katakana</option>
  <option>katakana-iroha</option>
  <option>lower-alpha</option>
  <option>lower-greek</option>
  <option>lower-latin</option>
  <option>lower-roman</option>
  <option>none</option>
  <option>square</option>
  <option>upper-alpha</option>
  <option>upper-latin</option>
  <option>upper-roman</option>
</select>

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

</body>
</html>



PreviousNext

Related