topical media & game development

talk show tell print

professional-javascript-17-CrossBrowserWebServiceExample.htm / htm



  <html>
      <head>
                <title>Cross-Browser Web Service Example</title>
          
          <script type="text/javascript" src="detect.js"></script>
          <script type="text/javascript" src="stringbuffer.js"></script>
          <script type="text/javascript" src="http.js"></script>
          <script type="text/javascript" src="webservice.js"></script>
          <script>
              function callWebService() {           
              
                  var sZip = document.getElementById("txtZip").value;
                  
                  var oService = new TemperatureService();
                  var fResult = oService.send(sZip);
                  
                  alert("It is currently " + fResult + " degrees in that zip code.");                    
              }
  
          </script>
      </head>
      <body>
          <p>This example uses the cross-browser <code>TemperatureService</code> object
          to get the temperature in a given zip code. By default, this will not work in
          newer browsers.</p>
          <p><input type="text" id="txtZip" size="10" />
          <input type="button" value="Get Temperature" onclick="callWebService()" /></p>
      </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.