国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

使用asp.net進行多關鍵字查詢的例子

2024-07-10 13:11:29
字體:
來源:轉載
供稿:網友

下面的代碼演示了如何對一段文本進行多關鍵字查詢并高亮顯示,給自己做為一個小tip保留下
<%@ page language="c#" debug="false" strict="true" explicit="true" buffer="true"%>
<%@ import namespace="system" %>
<html>
<head>
<title></title>
</head>
<style type="text/css">
.highlight {}{text-decoration:none; font-weight:bold; color:white; background:blue;}
</style>
<body bgcolor="#ffffff" topmargin="0"  onload="document.forms[0].keywords.focus();">
<script language="c#" runat="server">
void page_load(object source, eventargs e)
{
labeltxt.text = "give the proper respect to hand-coding.you should both respect and loathe handwritten code. you should

respect it because there are often special cases integrated into code that are overlooked with a cursory inspection. when

replacing code you’ve written by hand, you need to make sure you have the special cases accounted for. you should loathe

hand-code because engineering time is extremely valuable, and to waste it on repetitive tasks is nearly criminal. the goal

of your generator should always be to optimize the organization’s most valuable assets.the creativity and enthusiasm of

the engineering team.";
}
public string highlight(string search_str, string inputtxt)
{
    regex regexp = new regex(search_str.replace(" ", "|").trim(), regexoptions.ignorecase);
    return regexp.replace(inputtxt, new matchevaluator(replacekeywords));
    regexp = null;
}
public string replacekeywords(match m)
{
    return "<span class=highlight>" + m.value + "</span>";
}
public void buttonclick(object sernder,system.eventargs e )
{
    labeltxt.text = highlight(keywords.text, labeltxt.text);
}
</script>
<h3></h3><br>
<form runat="server" method="post">
<asp:textbox id="keywords" runat="server"/>
<asp:button id="button" text="submit" runat="server" onclick="buttonclick"/><br><br>
<asp:label id="labeltxt" runat="server"/>
</form>
</body>
</html>

商業源碼熱門下載www.html.org.cn

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 屯昌县| 阿拉善右旗| 乌恰县| 三台县| 乌什县| 开化县| 建昌县| 凯里市| 磐石市| 亳州市| 宁明县| 炉霍县| 和田市| 鸡西市| 安新县| 谢通门县| 江门市| 垣曲县| 靖西县| 许昌市| 孟津县| 荣成市| 高雄县| 牡丹江市| 沙湾县| 东阿县| 昌乐县| 壤塘县| 文昌市| 青州市| 章丘市| 贵南县| 子长县| 西峡县| 太仆寺旗| 兴和县| 邹平县| 盐山县| 静乐县| 永州市| 巴楚县|