Home > Web Front-end > JS Tutorial > body text

script does not refresh the page before and after the linkage code_javascript skills

WBOY
Release: 2016-05-16 17:22:14
Original
1142 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;
}
Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template