欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jquery 結(jié)合C#后臺(tái)的數(shù)組對(duì)文章的關(guān)鍵字自動(dòng)添加鏈接的代碼

 更新時(shí)間:2011年07月15日 00:57:35   作者:  
jquery 結(jié)合C#后臺(tái)的數(shù)組對(duì)文章的關(guān)鍵字自動(dòng)添加鏈接的代碼,需要的朋友可以參考下。
當(dāng)我們需要在后臺(tái)讀取多個(gè)關(guān)鍵字時(shí),我們可以先把后臺(tái)的數(shù)據(jù)庫(kù)讀取到一個(gè)數(shù)組中(在數(shù)據(jù)庫(kù)添加多個(gè)關(guān)鍵詞時(shí)用“,”隔開(kāi)):
復(fù)制代碼 代碼如下:

public string[] str; //添加一個(gè)公共數(shù)組一遍jquery調(diào)用
protected void Page_Load(object sender, EventArgs e)
{
string str1 = 讀取數(shù)據(jù)庫(kù)的關(guān)鍵詞;
str=str1.Split(',');
}
頁(yè)面的JQuery:
<html s>
<head >
<script type="text/javascript">
$(document).ready(function(){
<%for(int i=0;i<str.Length;i++){ %>
$("#content").html($("#content").html().replace(/<%=str[i] %>/g, " <a ><%=str[i] %> </a>"));
<%} %>
});
</script>
</head>
<body>
<div id="content">
<%=文章%>
</div>
</body>
</html>

相關(guān)文章

最新評(píng)論