无为清净楼资源网 Design By www.qnjia.com
复制代码 代码如下:
<asp:DropDownList ID="type1" runat="server" CssClass="tfont" onchange="link(this.id);" </asp:DropDownList>
<%-- 大小类--%>
<script>
function link(id)
{
var obj = document.getElementById(id);
var obj1 = document.getElementById('type2');
var name = "";
for(i = 0 ; i < obj.options.length ; i++ )
{
if(obj.options[i].selected)
{
name = obj.options[i].value;
}
}
var names = bargain_class.link(name).value.split(',');
var obj1_count = obj1.options.length
for (i = 0 ; i < obj1_count ; i++)
{
obj1.options.remove(0);
}
for (i = 0 ; i < names.length ; i ++ )
{
option1 = document.createElement("option");
option1.innerHTML = names[i];
obj1.appendChild(option1);
}
// alert(names);
}
</script>

//后台代码
AjaxPro.Utility.RegisterTypeForAjax(typeof(bargain_class)); //本页页面名

//===============================ajax调用=====================================
[AjaxPro.AjaxMethod]
public string link(string name)
{
string text = "";
string sql = "select name from Management_products_class where pid='" + name + "'";
DataTable dt = LinkSql.conn(sql);

for (int i = 0; i < dt.Rows.Count; i++)
{
if (text == "")
{
text = dt.Rows[i]["name"].ToString();
}
else
{
text += "," + dt.Rows[i]["name"].ToString();
}
}
return text;
}
标签:
script不刷新,页面联动

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com