熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

html自定義標簽

2022-06-13   來源: .NET編程 

  這是後台代碼

  代碼

  using System;

  using SystemCollections;

  using SystemConfiguration;

  using SystemData;

  using SystemLinq;

  using SystemWeb;

  using SystemWebSecurity;

  using SystemWebUI;

  using SystemWebUIHtmlControls;

  using SystemWebUIWebControls;

  using SystemWebUIWebControlsWebParts;

  using SystemXmlLinq;

  using SystemText;

  using SystemTextRegularExpressions;

  namespace WebApplication {

  public partial class _Default : SystemWebUIPage {

  protected void Page_Load(object sender EventArgs e) {

  String str = <a href=\{&a>\>{&a  }<a>{&bbbbccccc    };

  String b = cleanStr(str);

  string c = str(str);

  thisLabelText = c;

  }

  public string cleanStr(String str) {

  StringBuilder bs = new StringBuilder(str);

  string str = strSubstring( strLength );

  str = strTrim();

  return str;

  }

  public string str(string str) {

  int i = ;

  int i = ;

  string str_ = ;

  string str = ;

  string str = ;

  Boolean bl = false;

  Boolean bl = true;

  for (int i = ; i < strLength; i++) {

  if (str[i] == { && str[i + ] == &) {

  i = i;

  bl = true;

  bl = false;

  }

  if (bl) {

  str_ += str[i];

  }

  if (str[i] == } && bl) {

  i = i;

  str = strSubstring(i (i i) + );// +;

  str = strSubstring( strLength );

  str = strTrim();

  str = html_str(str);

  str_ += str;

  bl = false;

  bl = true;

  }

  }

  return str_;

  }

  public string html_str(string str) {

  if (str == a) {

  return html_str({&b});

  }

  if (str == b) {

  return html_str({&c});

  }

  if (str == c) {

  return html_str(進入qq);

  }

  return null;

  }

  public string html_str(string str) {

  Regex r = new Regex(@{+&+[AZaz]+});

  if (rIsMatch(str)) {

  return str(str);

  }

  return str;

  }

  }

  }

  前台代碼

  代碼

  <%@ Page Language=C# AutoEventWireup=true CodeBehind=Defaultaspxcs Inherits=WebApplication_Default %>

  <!DOCTYPE html PUBLIC //WC//DTD XHTML Transitional//EN transitionaldtd>

  <html xmlns= >

  <head id=Head runat=server>

  <title>Untitled Page</title>

  </head>

  <body>

  <form id=form runat=server>

  <div>

  <asp:Label ID=Label runat=server></asp:Label>

  </div>

  </form>

  </body>

  </html>

  運行結果

  <fp src=http://imgeducitycn/img_///png>


From:http://tw.wingwit.com/Article/program/net/201311/11752.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.