spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column112


JScript .NET, Part VI: Creating IE Web Services

Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source

The GUI for Consuming Web Services

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.

We implemented both consumers with TABLEs. 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.

The isprime TABLE has two rows. The first row includes an entry field for the number to be tested and a button to invoke the check. The second row includes a DIV element that displays the answer, via an innerHTML update. The ID of the input field is "testValue" and the ID of the result DIV is "theResult2". The button calls isPrimeNumber() when clicked. Here is the HTML code:

<TABLE BORDER="0">
  <TR>
    <TD>Enter a number:</TD>
    <TD><INPUT SIZE="4" TYPE="text"
      ID="testValue" VALUE="0">
    </TD>
    <TD>&nbsp;</TD>
    <TD><INPUT VALUE="Click here to check if prime"
	 TYPE="button" onclick="isPrimeNumber();"></TD>
  </TR>
  <TR><TD COLSPAN=4><DIV ID="theResult2"></DIV></TD>
  </TR>
</TABLE>

Next: How to script a page that consumes Web services

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

Whitepapers and eBooks

Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
IBM Solutions Brief: Go Green With IBM System xTM And Intel
HP eBook: Simplifying SQL Server Management
IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
Microsoft PDF: Top 10 Reasons to Move to Server Virtualization with Hyper-V
Microsoft PDF: Six Reasons Why Microsoft's Hyper-V Will Overtake Vmware
Microsoft Step-by-Step Guide: Hyper-V and Failover Clustering
Intel PDF: Quad-Core Impacts More Than the Data Center
Intel PDF: Virtualization Delivers Data Center Efficiency
Go Parallel Article: PDC 2008 in Review
Microsoft PDF: Top 11 Reasons to Upgrade to Windows Server 2008
Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
  PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
Go Parallel Article: Q&A with a TBB Junkie
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
IBM eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
HP eBook: Guide to Storage Networking
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Fixing MySQL Replication · Firewall Guide: First Steps to Securing the Enterprise · VoxOx Tames the Tumultuous Communications Tangle


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: June 17, 2002
Revised: June 17, 2002

URL: http://www.webreference.com/js/column112/5.html