topical media & game development

talk show tell print

professional-javascript-11-ListboxAddExample.htm / htm



  <html>
      <head>
          <title>Listbox Add Example</title>
          <script type="text/javascript" src="listutil.js"></script>
          <script type="text/javascript">
              function addItem() {
                  var oListbox = document.getElementById("selListbox");
                  var oTxtName = document.getElementById("txtName");
                  var oTxtValue = document.getElementById("txtValue");
       
                  ListUtil.add(oListbox, oTxtName.value, oTxtValue.value);
              }
          </script>
      </head>
      <body>
          <form>
              <select id="selListbox" size="5">
                   <option>Original Value</option>
              </select><br />
              Click the "Add" button to add an item with the following information:<br />
              Name: <input type="text" id="txtName" /><br />
              Value: <input type="text" id="txtValue" /><br />
              <input type="button" value="Add" onclick="addItem()" />
         </form>
      </body>
  <html>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.