JavaScript调用WebService
// <!CDATA[
//define
var xmlhttp;
var value=new Array();
var variable=new Array();
//Show Response MSG.
function handleStateChange()
{
var h=document.getElementById("Label1");
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{
alert(xmlhttp.responseText);
h.innerHTML=xmlhttp.responseText;
//h.innerHTML=xmlhttp.responseXML;
}
else if(xmlhttp.status==404)
{
h.innerHTML="<br>找不到请求的服务器资源!";
}
}
else if(xmlhttp.readyState==0)
{
h.innerHTML="<br>未初始化!";
}
else if(xmlhttp.readyState==1)
{
h.innerHTML="<br>正在加载……!";
}
else if(xmlhttp.readyState==2)
{
h.innerHTML="<br>已经加载完成!";
}
else if(xmlhttp.readyState==3)
{
h.innerHTML="<br>正在和服务器交互";
}
else
{
h.innerHTML=xmlhttp.responseXML;
}
}
//Get Request Data's length
function getlen(str)
{
var bytesCount=0;
for (var i = 0; i < str.length; i++)
{
var c = str.charAt(i);
if (/^[\u0000-\u00ff]$/.test(c)) //匹配双字节
{
bytesCount += 1;
}
else
{
bytesCount += 2;
}
}
return bytesCount;
}
//Create XMLHttpRequest Object
function createXMLHttpRequest()
{
if(window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequst)
{
xmlhttp=new XMLHttpRequest();
}
}
//send Request By HTTP POST
function RequestByPost(method,variable,value,url,_Namespace)
{
createXMLHttpRequest();
var data;
data = '<?xml version="1.0" encoding="utf-8"?>';
data = data + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
data = data + '<soap:Body>';
相关文档:
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......
Several programming languages implement a sprintf function, to output a formatted string. It originated from the C programming language, printf function. Its a string manipulation function.
This is limited sprintf Javascript implementation. Function returns a string formatted by the usual printf co ......
这里考虑的是.net服务器控件checkbox或checkboxList;
假设页面如下,chkDepart是部门,chkPeople是所属部门的人员
<div style="text-align: center" mce_style="text-align: center" width="95%" class="tab">
<asp:DataList ID="DataList1" ......
var myDate = new Date();
myDate.getYear(); //获取当前年份(2位)
myDate.getFullYear(); //获取完整的年份(4位,1970-????)
myDate.getMonth(); //获取当前月份(0-11,0代表1 ......
在javascript中用法举例
var rule = /^\d+$/;
if(!rule.test(addform.rmb_price.value)) {
alert('rmb_price must be number');
addform.rmb_price.focus();
return false;
}
在php中用法举例
$aa = "/^\d+$/";
if(preg_match($aa, "111")) {
echo "found";
}
在java中用法举例 ......