























<!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>send string</title>
<script language=javascript>
var xmlhttp;
function createxmlhttprequest()
{
if(window.ActiveXObject)
{
xmlhttp=new ActiveXObject((navigator.userAgent.toLowerCase().indexOf('msie 5') != -1) ? 'Microsoft.XMLHTTP' : 'Msxml2.XMLHTTP');
}
}
function sendstring()
{
for(var i=0;i<2;i++)
{
createxmlhttprequest();
xmlhttp.onreadystatechange=statechange;
xmlhttp.open('POST','ajax.aspx',false);
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send(getFormQueryString("ff"));
}
}
function statechange()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("x").innerHTML=xmlhttp.responseText;
}
}
function Button1_onclick() {
sendstring();
}
//得到一个表单里的全部信息
function getFormQueryString(frmID)
{
var frmID=document.getElementById(frmID);{
item
= frmID[i];// get form's each object{
if ( item.type == 'select-one' ){
itemValue
= item.options[item.selectedIndex].value;}
else if ( item.type=='checkbox' || item.type=='radio'){
if ( item.checked == false ){
continue;}
itemValue
= item.value;}
else if ( item.type == 'button' || item.type == 'submit' || item.type == 'reset' || item.type == 'image'){
// ignore this type}
else{
itemValue
= item.value;}
itemValue
= encodeURIComponent(itemValue);queryString
+= and + item.name + '=' + itemValue;and
="&";}
}
return queryString;}
</script>此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。