Change string to big, bold, fixed with form control : Introduction « Form « JavaScript Tutorial






<html>
<head>
  <script type="text/javascript">
    function showWindow() {
      var txt = document.form1.stringField.value;
      var clr = "";
      var sze = "";

      if (document.form1.bigBox.checked) txt = txt.big();
      if (document.form1.boldBox.checked) txt = txt.bold();
      if (document.form1.fixedBox.checked) txt = txt.fixed();

      objWindow = window.open("", "","width=600,height=300");
      objWindow.document.write(txt);
      objWindow.document.close();
  }
  </script>
</head>
<body>
  <form method="post" name="form1" action="null">
      String:<input type="text" size="40" maxlength="256" name="stringField" />
      Style:
      <input type="checkbox" name="bigBox" value="ON" />Big
      <input type="checkbox" name="boldBox" value="ON" />Bold
      <input type="checkbox" name="fixedBox" value="ON" />Fixed
    <input type="button" name="Show" value="Show" onclick="showWindow()" />
  </form>
</body>
</html>








10.1.Introduction
10.1.1.Form Basics
10.1.2.A form can contain any number of input elements:
10.1.3.Getting form References
10.1.4.Accessing form Fields
10.1.5.Form Field Commonalities
10.1.6.Change string to big, bold, fixed with form control
10.1.7.Change string to italics, small, strike with form control
10.1.8.Change string to subscript and superscript with form control