topical media & game development

talk show tell print

professional-javascript-18-AppletExample2.htm / htm



  <html>
      <head>
                <title>Applet Example</title>
          <script>
              
              function changeAppletMessage() {   
                  var oApplet = document.getElementById("ExampleApplet");
                  var oTextbox = document.getElementById("txtMessage");
                  
                  try {
                      oApplet.setMessage(oTextbox.value); 
                  } catch (oError) {
                      alert("Error caught: " + oError);
                  }                                  
              }
          </script>
      </head>
      <body>
          <p>Enter the message you want to see in the applet. If you leave the textbox
          blank and click Set Message, it will cause an error.</p>
          <p><input type="text" id="txtMessage" size="10" />
          <input type="button" value="Set Message" onclick="changeAppletMessage()" />
          </p>
                  
          <object type="application/x-java-applet" code="ExampleApplet2.class"
                  width="100" height="100" border="1" id="ExampleApplet">
              <comment>
                  <applet code="ExampleApplet2.class" width="100" height="100" 
                          name="ExampleApplet"></applet>
              </comment>            
          </object>
      </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.