首页javascriptselectJavascript Form - 如何获取选择选项文本...

Javascript Form - 如何获取选择选项文本...

我们想知道如何获取选择选项文本。...

  
<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>