将 文本格式标记 转化为 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(" ", " ");
oldStr = oldStr.Replace("<", "<");
oldStr = oldStr.Replace(">", ">");
oldStr = oldStr.Replace("<br/>", "\n");
oldStr = oldStr.Replace(" ", "\t");
oldStr = oldStr.Replace(""", "\"");
return newStr;
}
这时在
用文本可视化查看 为 :<FONT color=#e6421a>hgjghj</FONT>
用HTML可视化查看 为:hgjghj
此时前台控件显示的就将是hgjghj (保留样式,不显示标记)
如果要去掉所有标记,同时去掉样式, 只要在经过上面的方法处理之后,在经过以下方法即可
function RemoveHTML(strText)
{
var regEx = /<[^>]*>/g;
&nb
相关文档:
第一种:
<script language="javascript" type="text/javascript">
window.location.href="login.jsp?backurl="+window.location.href;
</script>
第二种:
<script language="javascript">
alert("返回");
window.history.back ......
flex嵌入到html:
用swfobject,下载的.js地址:http://www.adobe.com/devnet/activecontent/articles/devletter.html
在你的 HTML 页面头部<head>区嵌入这个脚本文件:<script type="text/javascript" src="swfobject.js"></script>
在你的 HTML 中写一个用来放 Flash 的容器,比如<div> ......
直接封装成一个类的,用起来还挺方便的
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text ......
摘自:http://www.pconline.com.cn/pcedu/sj/wz/html/0401/293106.html
meta是用来在HTML文档中模拟HTTP协议的响应头报文。meta 标签用于网页的<head>与</head>中,meta 标签的用处很多。meta 的属性有两种:name和http-equiv。name属性主要用 ......