代码改变世界

在javascript中用微软的htc组件调用web service

2006-12-23 14:41  BAsil  阅读(595)  评论(0编辑  收藏  举报
<script>
function init()
{
 service.useService(
"http://localhost/YSGL/YSEstablish/YuSuanHistory.asmx?WSDL","test");
 
var iCallID = service.test.callService("getResult");
}

function onWSresult()
{
 alert(event.result.value);
}

</script>
<body>
 
<div id="service" style="behavior:url(webservice.htc)" onresult="onWSresult()"></div>
</body>

webservice
[WebMethod]
        
public string getResult()
        
{
            
return "Hello World";
        }
最近在项目中尝试使用了部分YUI,等项目写完了,介绍一下。其实主要是一些简单的用法,还没有深入。另外YUI的邮件组真是好东西,我的很多问题都在上面找到了答案。