js 代码
function getarealist(res1,res2)
{
var cityid = res1.options[res1.selectedindex].value;
res2.length=0;
var ds = property_default.getarea(cityid).value;
if(ds != null&& typeof(ds) == "object" && ds.tables != null)
{
if(res1.selectedindex != 0)
{
for(var i=1; i<ds.tables[0].rows.length; i++)
{
var name=ds.tables[0].rows[i].areaname;
var id=ds.tables[0].rows[i].areaid;
res2.options.add(new option(name,id));
}
}
else
{
res2.options.add(new option("选择区域","0"));
}
}
}
cs 代码
[ajaxpro.ajaxmethod]//获得区域数据
public dataset getarea(int cityid)
{
string str = "select * from ktv_area where cityid=" + cityid;
dataset ds = database.exesqlda(str);
return ds;
}
private dataset getdata()
{
string str = "select * from property_city";
dataset ds = database.exesqlda(str);
return ds;
}
新闻热点
疑难解答