ajax
时间:2011-04-19 来源:Ring
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> <!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 runat="server"> <title></title> <script> var xmlHttp; function createXmlHttp() { if (window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } else { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } } function callBack() { if (xmlHttp.readyState == 4) { document.getElementById("tid").innerHTML = xmlHttp.responseText; } } function ajax(rid) { createXmlHttp(); xmlHttp.onreadystatechange = callBack; xmlHttp.open("GET", "list.aspx?id=" + rid, true); xmlHttp.send(null); } </script> </head> <body> <form id="form1" runat="server"> <div> <input type="text" id="testv" /> up<div id="tid"> </div> down <a href="#" onclick="ajax(document.getElementById('testv').value)">click me</a> </div> </form> </body> </html>
相关阅读 更多 +