今天图老师小编给大家介绍下利用ProtoType框架完成的一个下拉框(asp:DropDownList)联动的AJA,平时喜欢利用ProtoType框架完成的一个下拉框(asp:DropDownList)联动的AJA的朋友赶紧收藏起来吧!记得点赞哦~
【 tulaoshi.com - Web开发 】
最近终于有时间研究研究AJAX了.看了一些AJAX的介绍.
用ProtoType框架完成的一个下拉框(asp:DropDownList)联动的AJAX的小例子,和初学者分享一下.
代码下载
script language="javascript" type="text/javascript"
!--
function goCity()
{
var url = "AreaHandler.ashx";
var father= $F(’%=ddlProvince.ClientID%’)
var pars = "ddl=province&father=" +father;
var myAjax = new Ajax.Request(
url,
{method: ’get’, parameters: pars, onComplete: LoadCity}
);
}
function goArea()
{
var url = "AreaHandler.ashx";
var father= $F(’%=ddlCity.ClientID%’)
var pars = "ddl=city&father=" +father;
var myAjax = new Ajax.Request(
url,
{method: ’get’, parameters: pars, onComplete: LoadArea}
);
}
function LoadCity(originalRequest)
{
var result=originalRequest.responseText;
var ddl=$(’%=ddlCity.ClientID%’)
FillDropDown(ddl,result);
if (ddl.length == 0){
$(’%=ddlArea.ClientID%’).length=0;
$(’%=ddlArea.ClientID%’).disabled = 1;
ddl.disabled = ’true’;
}
else{
$(’%=ddlArea.ClientID%’).disabled = 0;
最近终于有时间研究研究AJAX了.看了一些AJAX的介绍.
用ProtoType框架完成的一个下拉框(asp:DropDownList)联动的AJAX的小例子,和初学者分享一下.
代码下载
script language="javascript" type="text/javascript"
!--
function goCity()
{
var url = "AreaHandler.ashx";
var father= $F(’%=ddlProvince.ClientID%’)
var pars = "ddl=province&father=" +father;
var myAjax = new Ajax.Request(
url,
{method: ’get’, parameters: pars, onComplete: LoadCity}
);
}
function goArea()
{
var url = "AreaHandler.ashx";
var father= $F(’%=ddlCity.ClientID%’)
var pars = "ddl=city&father=" +father;
var myAjax = new Ajax.Request(
url,
{method: ’get’, parameters: pars, onComplete: LoadArea}
);
}
function LoadCity(originalRequest)
{
var result=originalRequest.responseText;
var ddl=$(’%=ddlCity.ClientID%’)
FillDropDown(ddl,result);
if (ddl.length == 0){
$(’%=ddlArea.ClientID%’).length=0;
$(’%=ddlArea.ClientID%’).disabled = 1;
ddl.disabled = ’true’;
}
else{
$(’%=ddlArea.ClientID%’).disabled = 0;
ddl.disabled = 0;
goArea();
}
}
function LoadArea(originalRequest)
{
var result=originalRequest.responseText;
var ddl=$(’%=ddlArea.ClientID%’)
FillDropDown(ddl,result);
if (ddl.length == 0)
ddl.disabled =1;
esle
ddl.disabled =0;
来源:http://www.tulaoshi.com/n/20160219/1629364.html
看过《利用ProtoType框架完成的一个下拉框(asp:DropDownList)联动的AJA》的人还看了以下文章 更多>>