È¥³ýHTML¸ñʽ ½ØÈ¡×Ö·û´®
//½ØÈ¡²¿·ÖÄÚÈÝ·½·¨
public static string strvalue(string value, int length)
{
string strValue = NoHTML(value);// È¥³ýHTML±ê¼Ç
if (strValue.Length > length)
{
return strValue.Substring(0, length) + "...";
}
else
{
return strValue;
}
}
#region »Ø³µ,¿Õ¸ñ¹ýÂË
/**/
/// <summary>
/// È¥³ýHTML±ê¼Ç
/// </summary>
/// <param name="NoHTML">°üÀ¨HTMLµÄÔ´Âë </param>
/// <returns>ÒѾȥ³ýºóµÄÎÄ×Ö</returns>
public static string NoHTML(string Htmlstring)
{
//ɾ³ý½Å±¾
Htmlstring = Regex.Replace(Htmlstring, @"<script[^>]*?>.*?</script>", "",
RegexOpti
Ïà¹ØÎĵµ£º
Ê×ÏÈдһ¸öÒ³Ãæ£¬ÉÏÃæÒª·ÅÒ»¸öButton
<html>
<head>
<title></title>
</head>
<body>
<input id="Button1" type="button" value="button" />
</body>
</html>
½«Æä±£´ ......
<html:html>±êÇ©ÓÐÒ»¸ö lang ÊôÐÔ£¬ÓÃÓÚÏÔʾÓû§Ê¹ÓõÄÓïÑÔ£º
<html:html lang="true">
Èç¹û¿Í»§ä¯ÀÀÆ÷ʹÓÃÖÐÎÄ£¬ÄÇôÒÔÉÏ´úÂëÔÚÔËÐÐʱ½«±»½âÎöΪÆÕͨµÄ HTML ´úÂ룺
<html lang="zh-CN">
½âÊÍ£ºµ± lang ÊôÐÔΪ "true ......
StringBuilder sb = new StringBuilder();
Server.Execute("~/Default2.aspx", new StringWriter(sb));
File.WriteAllText(Server.MapPath("index.htm"), sb.ToString()); ......
×î½üÔÚŪ¹«Ë¾µÄϵͳʱÓöµ½Ò»¸öÎÊÌ⣬ÓÐÒ»¸öwinformÒªµ÷ÓÃÍøÕ¾µÄÊý¾Ý¿â£¬Êý¾Ý¿âÖдæµÄÊǾ¹ýeWebEditor´¦Àí¹ýµÄÎÄÕ£¬¶¼´øÓÐhtml±êÇ©£¬µ±Ê±ÏëÓÃÕýÔò±í´ïʽ¹ýÂ˵ô£¬µ«ÊÇ»¹ÊÇ·ÅÆúÁËÔÒòÓÐÈý£º1.ÎÒ¶ÔÕýÔò±í´ïʽÁ˽âºÜÉÙ£»2.Ëä˵ÎÒ¿ÉÒÔÏÖѧÕýÔò±í´ïʽ£¬µ«ÊÇʵÏÖÆðÀ´Ò²ÊǺÜÂé·³µÄ£»3.Èç¹û¹ýÂ˵ôµÄ»°ÎÄÕµĸñʽ¾ÍûÓÐÁË¡£ÓÚ ......
ÎļþÀàÐÍ <HTML></HTML> £¨·ÅÔÚµµ°¸µÄ¿ªÍ·Óë½á⣩
ÎļþÖ÷Ìâ <TITLE></TITLE> £¨±ØÐë·ÅÔÚ¡¸ÎÄÍ·¡¹Çø¿éÄÚ£©
ÎÄÍ· <HEAD></HEAD> £¨ÃèÊöÐÔ×ÊÁÏ£¬ÏñÊÇ¡¸Ö÷Ì⡹£©
ÎÄÌå <BODY></BODY> £¨Îļþ±¾Ì壩
½á¹¹ÐÔ¶¨Ò壨ÓÉä¯ÀÀÆ÷¿ØÖƵÄÏÔʾ·ç¸ñ£©
±êÌâ <H?></H?> ......