使用微软提供的webservice.htc实现通过JavaScript调用WebService.
1.首先从微软网站上下载webservice.htc,我附件源代码也包含,不下载也可以
http://msdn.microsoft.com/workshop/author/webservice/webservice.htc
2.在网页BODY中添加一个DIV,实现对webservice.htc的引用5.建立测试页面






























































































































7.数据库脚本


































9.源代码下载 /Files/singlepine/jsWebServices.rar

3.编写JavaScript,实现对WebService的引用:







sElementID.useService(sWebServiceURL, sFriendlyName [, oUseOptions] )
useService 参数:
sElementID | Required. The id of the element to which the WebService behavior is attached. | ||||||||
sWebServiceURL | Required. String specifying the URL of the Web Service, using one of the following path types. See the examples section, where several variations of this parameter are shown.
| ||||||||
sFriendlyName | Required. String representing a friendly name for the Web Service URL. | ||||||||
oUseOptions | Optional. An instance of the useOptions object. |
callService语法:
iCallID = sElementID.sFriendlyName.callService( [oCallHandler], fo, oParam )
callService参数:
sElementID | Required. The id of the element to which the WebService behavior is attached. | ||||
sFriendlyName | Required. The friendly name for the Web Service, which is defined by calling the useService method. | ||||
oCallHandler | Optional. Name of a script callback function that handles the results returned from this instance of the method call. | ||||
fo | Required. One of the following possible values.
| ||||
oParam | Required. One or more comma-delimited parameters, which are passed to the method name specified by fo. |
4.建立WebService,代码如下




























































































































