易截截图软件、单文件、免安装、纯绿色、仅160KB

将 文本格式标记 转化为 html格式标记

在做一个聊天记录的时候遇到这样一个问题,之前写入的带有特殊标记的文字,在写入数据库再读取的时候,带有html标记,
在后台调试,设置断点,取出的数据(hgjghj)(包括样式),
用文本可视化查看  为  :<FONT color=#e6421a>hgjghj</FONT>
用HTML可视化查看  为:<FONT color=#e6421a>hgjghj</FONT>
在js中利用  document.getElementById ("newmessage").innerHTML = str;将str赋值给newmessage控件时,显示的一直是:<FONT color=#e6421a>hgjghj</FONT>
如果要去掉font标记 ,只显示hgjghj
解决方法如下:
将str赋值给控件前,先经过以下方法处理。
public static string newStr(string oldStr)
        {
            oldStr = oldStr.Replace("&nbsp;", "   ");
            oldStr = oldStr.Replace("&lt;", "<");
            oldStr = oldStr.Replace("&gt;", ">");
            oldStr = oldStr.Replace("<br/>", "\n");
            oldStr = oldStr.Replace("&nbsp;&nbsp;&nbsp;", "\t");
            oldStr = oldStr.Replace("&quot;", "\"");
            return newStr;
        }
这时在
用文本可视化查看  为  :<FONT color=#e6421a>hgjghj</FONT>
用HTML可视化查看  为:hgjghj
此时前台控件显示的就将是hgjghj (保留样式,不显示标记)
如果要去掉所有标记,同时去掉样式, 只要在经过上面的方法处理之后,在经过以下方法即可
function RemoveHTML(strText)
          {
            var regEx = /<[^>]*>/g;
   &nb


相关文档:

javascript之HTML(select option)详解

一、基础理解:
var e = document.getElementById("selectId");
e. options= new Option("文本","值") ;
//创建一个option对象,即在<select>标签中创建一个或多个<option value="值">文本</option>
//options是个数组,里面可以存放多个<option value="值">文本</option>这样的标签
1:opt ......

TextBox 超链接替换成HTML超链接形式


            string tent = this.TextBox_info.Text.Replace("<", "&lt;").Replace(">", "&gt;").Replace(" ", "&nbsp;&nbsp;&nbsp;&nbsp;").Trim().Replace("\n", "<br/>");
       & ......

去除字符串中的Html代码

        /// <summary>
        /// 去掉所有HTML标签
        /// </summary>
        /// <param name="strHtml">源字符串</param> ......

html header文件格式类

来源:网络
header文件格式类:
'gif' => 'image/gif',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'jpe' => 'image/jpeg',
'bmp' => 'image/bmp',
'png' => 'image/png',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'pict' => 'image/x-pict',
'pic' => 'i ......

获取其它进程中的Web Browser中的HTML源码


HWND H1,H2,H3,H4,hw;
 H1=H2=H3=H4=hw=NULL;
 H1=::FindWindow("TForm1",NULL);
 if (H1) H2=::FindWindowEx(H1,NULL,"Shell Embedding",NULL);
 if (H2) H3=::FindWindowEx(H2,NULL,"Shell DocObject View",NULL);
 if (H3) H4=::FindWindowEx(H3,NULL,"Internet Explorer_Server",NULL) ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号