国产探花免费观看_亚洲丰满少妇自慰呻吟_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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 津南区| 茂名市| 阳新县| 平武县| 神池县| 东乡县| 栖霞市| 金华市| 观塘区| 高碑店市| 神木县| 泗洪县| 眉山市| 普安县| 南华县| 福贡县| 当阳市| 湘西| 宜良县| 瓦房店市| 丰宁| 寻甸| 博爱县| 太仆寺旗| 石泉县| 淳化县| 基隆市| 永和县| 浮梁县| 上饶县| 东港市| 锡林郭勒盟| 桐柏县| 宜川县| 临夏市| 定西市| 沂南县| 视频| 辉南县| 广宁县| 长葛市|