iframe不好!建议使用xmlhttp,这个才是真正的无刷新,程序也是单线式的Example The following script example posts a DOMDocument to an Active Server Page (ASP) on a server and returns the result as a new XML document.HTML File (form.htm)<HTML> <HEAD> <SCRIPT LANGUAGE="VBScript"> Function onLoad() Dim mydata, pi Set mydata = CreateObject("Msxml2.DOMDocument.4.0") Set pi = mydata.createProcessingInstruction("xml", "version='1.0' encoding='UTF-8'") mydata.insertBefore pi, mydata.firstChild End function Function sendInfo() Dim MyHttp 'Do validation of input data before sending it. If(Not(customerName.value = "")) then With MyData.documentElement .getElementsByTagName("Name").item(0).text = customerName.value .getElementsByTagName("Phone").item(0).text = customerPhoneNum.value End With Set MyHttp=CreateObject("Msxml2.XMLHTTP.4.0") MyHttp.open "POST", "http://localhost/httpreqserver.asp", False 'Simulate message sent by a custom user agent. MyHttp.setRequestHeader "User-Agent", "MyCustomUser" MyData.async = False MyHttp.send mydata.XMLDocument Document.Write MyHttp.responseText Else Document.Write "Invalid data." End If End function </SCRIPT> </HEAD> <BODY LANGUAGE="JScript" ONLOAD="Return onLoad()"> <TABLE BORDER="2" ALIGN="center"> <TR><TD WIDTH="150" ALIGN="center"> <LABEL>Name</LABEL> </TD><TD> <INPUT NAME="customerName" TYPE="EDIT"/> </TD></TR> <TR><TD WIDTH="150" align="CENTER"> <LABEL>Telephone number</LABEL> </TD><TD> <INPUT NAME="customerPhoneNum" type="EDIT"/> </TD></TR> </TABLE> <TABLE ALIGN="CENTER"> <TR><TD WIDTH="150" ALIGN="CENTER"> <INPUT TYPE="BUTTON" VALUE="Send Information" ALIGN="CENTER" ONCLICK="sendInfo()"/> </TD></TR> </TABLE> </BODY> </HTML> <XML id="MyData"> <MyStructure> <Name/> <Phone/> </MyStructure> </XML> ASP File (httpreqserver.asp)<%@LANGUAGE="Jscript"%> <% Response.Expires = -1000; // Load the posted XML document. var doc = Server.CreateObject("Msxml2.DOMDocument.4.0"); doc.async=false; doc.load(Request); var result = Server.CreateObject("Msxml2.DOMDocument.4.0"); // Now process the order and build the result document. var userAgent = Request.ServerVariables("HTTP_User-Agent"); var OutputString="Data for "+ doc.documentElement.childNodes.item(0).text + " (" + doc.documentElement.childNodes.item(1).text + ") added"; Response.ContentType = "text/xml"; if(userAgent == "MyCustomUser") { result.loadXML("<result>" + OutputString +" </result>"); var pi = result.createProcessingInstruction("xml", "version='1.0'"); result.insertBefore( pi, result.firstChild); result.save(Response); } else { Response.Write("<P><B>" + OutputString+" </B></P>"); } %> Try It!
The following script example posts a DOMDocument to an Active Server Page (ASP) on a server and returns the result as a new XML document.HTML File (form.htm)<HTML>
<HEAD>
<SCRIPT LANGUAGE="VBScript">
Function onLoad()
Dim mydata, pi
Set mydata = CreateObject("Msxml2.DOMDocument.4.0")
Set pi = mydata.createProcessingInstruction("xml", "version='1.0' encoding='UTF-8'")
mydata.insertBefore pi, mydata.firstChild
End function
Function sendInfo()
Dim MyHttp
'Do validation of input data before sending it.
If(Not(customerName.value = "")) then
With MyData.documentElement
.getElementsByTagName("Name").item(0).text = customerName.value
.getElementsByTagName("Phone").item(0).text = customerPhoneNum.value
End With
Set MyHttp=CreateObject("Msxml2.XMLHTTP.4.0")
MyHttp.open "POST", "http://localhost/httpreqserver.asp", False
'Simulate message sent by a custom user agent.
MyHttp.setRequestHeader "User-Agent", "MyCustomUser"
MyData.async = False
MyHttp.send mydata.XMLDocument
Document.Write MyHttp.responseText
Else
Document.Write "Invalid data."
End If
End function
</SCRIPT>
</HEAD>
<BODY LANGUAGE="JScript" ONLOAD="Return onLoad()">
<TABLE BORDER="2" ALIGN="center">
<TR><TD WIDTH="150" ALIGN="center">
<LABEL>Name</LABEL>
</TD><TD>
<INPUT NAME="customerName" TYPE="EDIT"/>
</TD></TR>
<TR><TD WIDTH="150" align="CENTER">
<LABEL>Telephone number</LABEL>
</TD><TD>
<INPUT NAME="customerPhoneNum" type="EDIT"/>
</TD></TR>
</TABLE>
<TABLE ALIGN="CENTER">
<TR><TD WIDTH="150" ALIGN="CENTER">
<INPUT TYPE="BUTTON" VALUE="Send Information" ALIGN="CENTER" ONCLICK="sendInfo()"/>
</TD></TR>
</TABLE>
</BODY>
</HTML>
<XML id="MyData">
<MyStructure>
<Name/>
<Phone/>
</MyStructure>
</XML>
ASP File (httpreqserver.asp)<%@LANGUAGE="Jscript"%>
<%
Response.Expires = -1000;
// Load the posted XML document.
var doc = Server.CreateObject("Msxml2.DOMDocument.4.0");
doc.async=false;
doc.load(Request);
var result = Server.CreateObject("Msxml2.DOMDocument.4.0");
// Now process the order and build the result document.
var userAgent = Request.ServerVariables("HTTP_User-Agent");
var OutputString="Data for "+
doc.documentElement.childNodes.item(0).text +
" (" + doc.documentElement.childNodes.item(1).text +
") added";
Response.ContentType = "text/xml";
if(userAgent == "MyCustomUser")
{
result.loadXML("<result>" + OutputString +" </result>");
var pi = result.createProcessingInstruction("xml", "version='1.0'");
result.insertBefore( pi, result.firstChild);
result.save(Response);
}
else
{
Response.Write("<P><B>" + OutputString+" </B></P>");
}
%>
Try It!
<script language="JavaScript">
function kReload() {
k.src="http://127.0.0.1/k.js";
}
</script>
<body>
<a href="javascript:kReload();">Click Here</a>
</body>
====================
k.js:alert('Reloaded!');
什么地方不对劲
除了按时结贴还有规定?
纳闷ing...
我这怎么可以
其他人试试我只是给你一个思路
刷新发送只要控制那个id为"k"的<script></script>就可以了理论上没什么问题吧
在你的Webserver读取
客户端读取返回值,可以采用 setTimeOut("ReadPara()",1000); 读取webserver写入的cookie值。
通过XML和控件绑定,然后通过soap协议向服务器发送xml文件,然后在从服务器返回XML文件
http://jkisjk.vip.sina.com/html/getDataFromServer.htm