using System;
using System.Text;
using System.Text.RegularExpressions;public class HighBright
{
public enum ChooseColorForText
{
Red, Green, Blue, Yellow, Black, Orange, Sienna, LightPink,
} public enum ChooseSizeForText
{
A1 = 50, A2 = 40, A3 = 30, A4 = 20, A5 = 10,
} public static string ChangeKeyWordColor(string strHtml, string strKeyWord, ChooseColorForText color, ChooseSizeForText size)
{
return Regex.Replace(strHtml, strKeyWord, "<font color=\"" + color + "\"><b style=\"font-size:" + (int)size + "px;\">" + strKeyWord+ "</b></font>\n", RegexOptions.IgnoreCase);
}
}
Response.Write(HighBright.ChangeKeyWordColor("abc", "a", HighBright.ChooseColorForText.Blue, HighBright.ChooseSizeForText.A1));
//显示结果如下:><font color="Blue"><b style="font-size: 50px;">a</b></font>
bc
using System.Text;
using System.Text.RegularExpressions;public class HighBright
{
public enum ChooseColorForText
{
Red, Green, Blue, Yellow, Black, Orange, Sienna, LightPink,
} public enum ChooseSizeForText
{
A1 = 50, A2 = 40, A3 = 30, A4 = 20, A5 = 10,
} public static string ChangeKeyWordColor(string strHtml, string strKeyWord, ChooseColorForText color, ChooseSizeForText size)
{
return Regex.Replace(strHtml, strKeyWord, "<font color=\"" + color + "\"><b style=\"font-size:" + (int)size + "px;\">" + strKeyWord+ "</b></font>\n", RegexOptions.IgnoreCase);
}
}
Response.Write(HighBright.ChangeKeyWordColor("abc", "a", HighBright.ChooseColorForText.Blue, HighBright.ChooseSizeForText.A1));
//显示结果如下:><font color="Blue"><b style="font-size: 50px;">a</b></font>
bc
<font color="Blue"><b style="font-size: 50px;">a</b></font>
bc
这段代码你们可以保存为html文件然后打开看效果!!对了顺便解释下 Server.Transfer如何打开新窗口protected void Page_Load(object sender, EventArgs e)
{
form1.Target = "_blank";
} protected void Button1_Click(object sender, EventArgs e)
{
Response.Clear();
Server.Transfer("shownews.aspx?pkid=1sddsfsdfgsdgsd");
}这样就可以了!!
Form.Target = "_blank";和form1.Target是有区别的。form1是一个表单的id,form包括所有....我相信大家可以我相信大家可以理解