<SCRIPT type = "text/JavaScript" Language = "JavaScript">
Function onbuttongo_click ()
{
Requestsimpleservice = webservicedemo. strtostring (
Document. getelementbyid ('inputname'). Value, // Params
Onrequestcomplete // Complete Event
);
Return false;
}
Function onrequestcomplete (result ){
Alert (result );
}
</SCRIPT>
<Asp: scriptmanager id = "scriptmanager1" runat = "server">
<Services>
<Asp: servicereference Path = "~ /Webservicedemo. asmx "/>
</Services>
</ASP: scriptmanager>
<Input type = "text" id = "inputname" size = 20/>
<Input id = "button" type = "button" value = "call" onclick = "Return onbuttongo_click ()"/>
Webservicedemo. asmx
Using system;
Using system. Collections. Generic;
Using system. Web;
Using system. Web. Services;
Using system. Web. Script. Services;
[Scriptservice]
Public class webservicedemo: system. Web. Services. WebService {
Public webservicedemo (){
// If you use the designed component, uncomment the following line
// Initializecomponent ();
}
[Webmethod]
Public String strtostring (string Str)
{
Return "WebService output:" + STR;
}
}