js调用WebService的例子
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Service.aspx.cs" Inherits="Service" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>testXML</title>
<script id="clientEventHandlersJS" type="text/javascript">
function getdata()
{
var index=0;
docSubmit =new ActiveXObject("Microsoft.XMLDOM");
docSubmit.async = false;
docSubmit.load("http://192.168.128.250:1050/smsstatservice/totalstat.asmx/RegUsers");
div1.innerHtml ="";
div1.innerHTML="注册用户:" docSubmit.xml;
div1.style.visibility="visible";
docSubmit.load("http://192.168.128.250:1050/smsstatservice/totalstat.asmx/GetTodaySMS");
div2.innerHtml ="";
div2.innerHTML="今天发送:" docSubmit.xml;
docSubmit.load("http://192.168.128.250:1050/smsstatservice/totalstat.asmx/GetThisMonthSMS");
div3.innerHtml ="";
div3.innerHTML="本月发送:" docSubmit.xml;
docSubmit.load("http://192.168.128.250:1050/smsstatservice/totalstat.asmx/GetAllSMS");
div4.innerHtml ="";
div4.innerHTML="共发送:" docSubmit.xml;
}
</script>
<script type="text/javascript">
setInterval(getdata,1000); //动态定时调用,可以实现无刷新的动态提取数据库,动态提醒等功能!
</script>
</head>
<body onload="getdata()">
<input type="button" value="Button" onclick="getdata()" /><br />
<span id="div1" class="list"></span>
<br />
<span id="div2" class="list"></span>
<br />
<span id="div3" class="list"></span>
<br />
<span id="div4" class="list"></span>
<br />
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>testXML</title>
<script id="clientEventHandlersJS" type="text/javascript">
function getdata()
{
var index=0;
docSubmit =new ActiveXObject("Microsoft.XMLDOM");
docSubmit.async = false;
docSubmit.load("http://192.168.128.250:1050/smsstatservice/totalstat.asmx/RegUsers");
div1.innerHtml ="";
div1.innerHTML="注册用户:" docSubmit.xml;
div1.style.visibility="visible";
docSubmit.load("http://192.168.128.250:1050/smsstatservice/totalstat.asmx/GetTodaySMS");
div2.innerHtml ="";
div2.innerHTML="今天发送:" docSubmit.xml;
docSubmit.load("http://192.168.128.250:1050/smsstatservice/totalstat.asmx/GetThisMonthSMS");
div3.innerHtml ="";
div3.innerHTML="本月发送:" docSubmit.xml;
docSubmit.load("http://192.168.128.250:1050/smsstatservice/totalstat.asmx/GetAllSMS");
div4.innerHtml ="";
div4.innerHTML="共发送:" docSubmit.xml;
}
</script>
<script type="text/javascript">
setInterval(getdata,1000); //动态定时调用,可以实现无刷新的动态提取数据库,动态提醒等功能!
</script>
</head>
<body onload="getdata()">
<input type="button" value="Button" onclick="getdata()" /><br />
<span id="div1" class="list"></span>
<br />
<span id="div2" class="list"></span>
<br />
<span id="div3" class="list"></span>
<br />
<span id="div4" class="list"></span>
<br />
</body>
</html>