
昨天晚上完成了代码高亮的显示,这样可以在站内发布的代码可以在网页中显示平时我们写程序时显示的颜色,方便阅读,另外也增加了“放大”、“复制”等功能,让你轻松查看和复制。
主要是利用.net的正则表达式来进行种替换,达到彩色目的:
下面是演示:
Aspx/HTML代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="ExfSoft.Blog.WebForm1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>测试</title> <%--<base target="_self" />--%> <script type="text/javascript"> function test() { var a = "ExfSoft"; alert(a); } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="edt_test" runat="server"></asp:TextBox> </div> </form> </body> </html>
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace ExfSoft.Blog { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { int bb = 1; edt_test.Text = bb.ToString() + "ExfSoft.Com"; } } }