- 论坛徽章:
- 0
|
re
ajax呀
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <HTML>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=GB2312">
- <TITLE> ajax </TITLE>
- <META NAME="Generator" CONTENT="EditPlus">
- <META NAME="Author" CONTENT="">
- <META NAME="Keywords" CONTENT="">
- <META NAME="Description" CONTENT="">
- <script type="text/javascript">
- var xmlHttp;
- function createXMLHttpRequest()
- {
- if(window.ActiveXObject)
- {
- xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
- else if(window.XMLHttpRequest)
- {
- xmlHttp = new XMLHttpRequest();
- }
- }
- function startRequest()
- {
- createXMLHttpRequest();
- xmlHttp.onreadystatechange = handleStateChange;
- xmlHttp.open("GET","innerHTML.xml",true);
- xmlHttp.send(null);
- }
- function handleStateChange()
- {
- if(xmlHttp.readyState == 4)
- {
- if(xmlHttp.status == 200)
- {
- document.getElementById("results").innerHTML = xmlHttp.responseText;
- }
- }
- }
- </script>
- </HEAD>
- <BODY>
- <form action="#">
- <input type="button" value="Search for Today's Activities" onClick="startRequest();"/>
- </form>
- <div id="results"></div>
- </BODY>
- </HTML>
复制代码
把xmlHttp.open("GET","你要连接的处理程序",true);改一下就行了, |
|