script does not refresh the page before and after the linkage code_javascript skills
Release: 2016-05-16 17:22:14
Original
1172 people have browsed it
<%-- 大小类--%>
<script> <br>function link(id) <br>{ <br>var obj = document.getElementById(id); <br>var obj1 = document.getElementById('type2'); <br>var name = ""; <br>for(i = 0 ; i < obj.options.length ; i ) <BR>{ <BR>if(obj.options[i].selected) <BR>{ <BR>name = obj.options[i].value; <BR>} <BR>} <BR>var names = bargain_class.link(name).value.split(','); <BR>var obj1_count = obj1.options.length <BR>for (i = 0 ; i < obj1_count ; i ) <BR>{ <BR>obj1.options.remove(0); <BR>} <BR>for (i = 0 ; i < names.length ; i ) <BR>{ <BR>option1 = document.createElement("option"); <BR>option1.innerHTML = names[i]; <BR>obj1.appendChild(option1); <BR>} <BR>// alert(names); <BR>} <BR></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;
}
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31