¼òµ¥µÄAJAX»ñÈ¡Êý¾Ý¿â±íÊý¾Ý
A.aspxÒ³Ãæ·ÅÒ»¸ödropdownlist£¬ÔÚA.aspx.csÌí¼Ó£º this.drpSchool.Attributes.Add("onchange", "load(this.options[this.selectedIndex].value)");
ÔÚA.aspxÒ³ÃæÌí¼ÓÈçϽű¾£º
function load(state){
var oHttpReq = new ActiveXObject("MSXML2.XMLHTTP");
var oDoc = new ActiveXObject("MSXML2.DOMDocument");
oHttpReq.open("POST", "../B.aspx?state="+state, false);
oHttpReq.send("");
result = oHttpReq.responseText;
oDoc.loadXML(result);
items1 = oDoc.selectNodes("//NewDataSet/Table/dtid");
items2 = oDoc.selectNodes("//NewDataSet/Table/dtname");
var itemsLength=items1.length;
¡¡¡¡for(i=0;i<itemsLength;i++)
//½«Ð¡ÀàµÄÀàÃûºÍ±àºÅ¸³ÓèDropDownList2
¡¡¡¡{
¡¡
¡¡¡¡var newOption = document.createElement("OPTION");
¡¡¡¡newOption.text=items2[i].text;
¡¡¡¡newOption.value=items1[i].text;
¡¡¡¡drp2.options.add(newOption);
¡¡¡¡//¡¡newOption.value=6;
¡¡
¡¡¡¡}
}
B.aspx.csÒ³Ã棺
if (Request.QueryString["state"] != null && Request.QueryString["state"].ToString() != "")
{
try
{
int shengNo = int.Parse(Request["state"].ToString());
// int shengNo = 1;
DataSet ds = new DataSet();
db dbb = new db();
ds = dbb.GetDataSet(SQLÓï¾ä);
if (ds.Tables[0].Rows.Count > 0)
&nb
Ïà¹ØÎĵµ£º
ÈçÉÏͼËùʾΪAccordion¿Ø¼þ£º
¸Ð¾õ²»´íµÄÑùʽ
<style type="text/css">
.headerBg{cursor:hand;text-align:center;width:180px;height:21px;background-image:url(images/ajaxmenubg1.gif);FONT-SIZE: 12px;line-height:21px;} ......
Ajax
Ö÷
Òª×é³É²¿·Ö
Ajax
ÊÇ
Asynchronous JavaScript and XML
£¨ÒÔ
¼°
DHTML
µÈ£©µÄËõд¡£
Ajax
ÓÉ
HTML
¡¢
JavaScript™
¼¼Êõ¡¢
DHTML
ºÍ
DOM
×é³É£¬ÕâÒ»½Ü³öµÄ·½·¨¿ÉÒÔ½«±¿×¾µÄ
Web
½çÃæת»¯³É½»»¥ÐÔµÄ
Ajax
Ó¦ÓóÌÐò¡£
AjaxµÄºËÐÄÊÇJavaScript¶ÔÏó XmlHttpRequest¡£¸Ã¶ÔÏóÔ ......
<html>
<body>
<script type="text/javascript">
function ajaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Inte ......
ÔÚ±¾½ÚÎÒ×¼±¸Ö»Ð´ÉϹØÓÚAjaxµÄ˵Ã÷£¬¶àÊýÀ´×ÔjQueryµÄ°ïÖúÎĵµ£¬ËùÒÔ²»Òª·ÅÔÚÊ×Ò³¡£ÒòΪÎÒ¾õµÃÊ×Ò³Ó¦¸ÃÊÇÒª»¨·ÑÁËʱ¼äºÍÐÄ˼µÄ×÷Æ·¡£´úÂëÑÝʾºÍjQuery Ajax һЩеģ¬½«ÔÚÏÂÒ»´ÎÓпÕʱ½²Êö£¬ÕâÀï¾Í²»½²ÁË¡£Ê±¼äÒѾ0³¿ÁË¡£Èç¹ûÄã¾ÙµÃÓÐʲôjQueryµÄÒÉÎÊ»òÕß¾õµÃAjax¸Ã½²ÊöÄÇЩÄÚÈݵĶ¼¿ÉÒÔ¸úÎÒÁô ......
ScriptManager.RegisterStartupScript(p1, this.GetType(), "click", "alert('ok')", true);//p1ÊÇupdatepanelµÄid
ScriptManager.RegisterStartupScript(p1, this.GetType(), "click", "alert('ok')", true);//p1ÊÇupdatepanelµÄid
......