spacer
Yehuda Shiran July 12, 2002
Calling the add Web Service from DHTML
Tips: July 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management
We have explained in Column 106 how to consume Web services through Microsoft Internet Explorer. There are three HTML items you need to add to your page for it to consume Web services:

  • onload="init()". Add this event handler to your BODY tag. For example:

      <BODY BGCOLOR="#ffffff" onload="init()">
  • Instantiate the webservice behavior. You can share this behavior among all Web services you consume from your page:

      <DIV ID="myWebService" STYLE="behavior:url(webservice.htc)"></DIV>
  • GUI. Implement some way to collect user parameters and display the results. Simple INPUT elements will do.

The add TABLE consists of four rows. You enter the first and second integers in the first and second rows, respectively, where we use INPUT fields. The third line is for putting a total ruler and a button to invoke the addition. The fourth line displays the result, by way of a DIV element: we update its innerHTML. Here is the add TABLE:

  <TABLE BORDER="0">
    <TR><TD>Enter First Number:</TD><TD><INPUT SIZE="4" 
            TYPE="text" ID="first" STYLE="text-align:'right'"></TD></TR>
    <TR><TD>Enter Second Number:</TD><TD><INPUT SIZE="4" 
            TYPE="text" ID="second" STYLE="text-align:'right'"></TD></TR>
    <TR><TD align="right"><INPUT VALUE="Add" TYPE="button"
            onclick="addNumbers();"></TD><TD><HR></TD></TR>
    <TR><TD></TD><TD><DIV ID="theResult1" 
                      STYLE="text-align:'right'"></DIV></TD></TR>
  </TABLE>
Notice the ID of the various fields. The ID of the first number field is "first", the ID of the second number field is "second", and the ID of the result DIV is "theResult1". The Add button invokes the addNumbers() function when clicked.

To learn more about JScript .NET, go to Column 112, JScript .NET, Part VI: Creating IE Web Services.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Administering MySQL Databases on the Web Using PHP · Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
So what is an Oracle Nested Table? · E-Discovery Architectures 101 · eBay Embraces Big Sellers, Cyber Monday Trends