导航:首页 > 净水问答 > html在线编辑带过滤

html在线编辑带过滤

发布时间:2022-07-26 22:32:19

『壹』 asp.net c# 过滤 html编辑器内容

Asp.net中如何过滤html,js,css代码
以下为引用的内容:

#region/// 过滤html,js,css代码
/// <summary>
/// 过滤html,js,css代码
/// </summary>
/// <param name="html">参数传入</param>
/// <returns></returns>
public static string CheckStr(string html)
{
System.Text.RegularExpressions.Regex regex1 = new System.Text.RegularExpressions.Regex(@"<script[\s\S]+</script *>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex2 = new System.Text.RegularExpressions.Regex(@" href *= *[\s\S]*script *:", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex3 = new System.Text.RegularExpressions.Regex(@" no[\s\S]*=", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex4 = new System.Text.RegularExpressions.Regex(@"<iframe[\s\S]+</iframe *>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex5 = new System.Text.RegularExpressions.Regex(@"<frameset[\s\S]+</frameset *>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex6 = new System.Text.RegularExpressions.Regex(@"\<img[^\>]+\>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex7 = new System.Text.RegularExpressions.Regex(@"</p>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex8 = new System.Text.RegularExpressions.Regex(@"<p>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex9 = new System.Text.RegularExpressions.Regex(@"<[^>]*>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
html = regex1.Replace(html, ""); //过滤<script></script>标记
html = regex2.Replace(html, ""); //过滤href=javascript: (<A>) 属性
html = regex3.Replace(html, " _disibledevent="); //过滤其它控件的on...事件
html = regex4.Replace(html, ""); //过滤iframe
html = regex5.Replace(html, ""); //过滤frameset
html = regex6.Replace(html, ""); //过滤frameset
html = regex7.Replace(html, ""); //过滤frameset
html = regex8.Replace(html, ""); //过滤frameset
html = regex9.Replace(html, "");
html = html.Replace(" ", "");
html = html.Replace("</strong>", "");
html = html.Replace("<strong>", "");
return html;
}
#endregion
#region /// 过滤p /p代码
/// <summary>
/// 过滤p /p代码
/// </summary>
/// <param name="html">参数传入</param>
/// <returns></returns>
public static string InputStr(string html)
{
html = html.Replace(@"\<img[^\>]+\>", "");
html = html.Replace(@"<p>", "");
html = html.Replace(@"</p>", "");
return html;
}
#endregion

『贰』 uEditor 如何过滤html标签

你可以在数据保存的时候,通过你服务端语言来过滤;

或者再数据保存前,用js过滤之后再进行保存。

但既然选择使用富文本编辑器,何必在数据库中显示不带HTML标签的内容?

『叁』 ueditor插入html代码保存后,再次编辑文章时html代码被过滤只显示文本内容!

遇到问题多看官方文档和官方API。

官方初始化参数文档:http://fex..com/ueditor/#start-config

官方API文档:http://ueditor..com/doc/


最简单的解决方专法如下:

//如下写属法即可
varue=UE.getEditor("editor",{
initialContent:"${initParam}"
});

如果不能满足要求,比如这样的话,之前在文本中插入的图片,在修改时会展示<img>标签,可以用filterTxtRules选项解决。当然,一般没人会把图片也跟文本一起存入数据库

『肆』 js对html代码的过滤

<script type="text/javascript">
var word="正常内容onclick,onmouseover,正常内容,正常内容";
word=word.replace(/onclick/g,"");
word=word.replace(/onmouseover/g,"");
alert(word);
</script>

『伍』 我想将一个编辑器(eWebEditor)输入的内容中有HTML标记过滤掉,只剩下纯文章,请问有这样的函数或代码么

eWebEditor本身就有纯文本标签,可以选择它粘贴文字,就是无Html标签的文字。当然,如果你的内容里如果有其它需要包含Html标签内容,最简单的办法就是打开开始-〉程序-〉附件-〉记事本,将doc文本粘贴到里面,再全选复制,再粘贴到编辑器中就是不带格式的纯文本,不过应该也会有<p>标签。

『陆』 php如何过滤编辑器的html标签

选择1.将特殊符号进行转换,可以用htmlspecialchars把<变为“<”等
选择2.用正则表达式替换,将标签都删除:
$content=preg_replace('/\<.+?\>/','',$content);

『柒』 C# 堆文本编辑器里面的内容html标签进行过滤,除了a标签以外全部过滤

用正则表抄达式来袭做
引用 using System.Text.RegularExpressions;

Match result;
result = Regex.Match(文本, @"(?<value><a>.+?<\/a>)");
string getstring = string.Empty;
while (result.Success)
{
getstring += result.Groups["value"].Value;
result = result.NextMatch();
}
getstring就是内容了

『捌』 想过滤 html 在线编辑器中含有超链接的内容,然后提交到数据库! 网站是Asp网站!这个过滤怎么做

应该都是用正则表达式吧、

『玖』 asp.net 中怎么把后台通过文本编辑器添加的内容过滤掉html字符,然后在前台显示出来试过了网上写的办法

public static string NoCode(string str)
{
if (str == null || str.Length == 0) return "";
str = System.Text.RegularExpressions.Regex.Replace(str, @"\<(?<x>[^\>]*)\>", @"", RegexOptions.IgnoreCase);
str = System.Text.RegularExpressions.Regex.Replace(str, @"\[(?<x>[^\]]*)\]", @"", RegexOptions.IgnoreCase);
str = str.Replace("", " ");
str = str.Replace(">", ">");
str = str.Replace("<", "<");
str = str.Replace("\n", " ");
str = str.Replace("\r", "");
str = str.Replace("'", "");
return str;
}

用这个就可以全部过虑掉

阅读全文

与html在线编辑带过滤相关的资料

热点内容
浙江污水处理怎么选 浏览:589
现在污水管网用什么管网 浏览:603
绘画分析疗法中污水代表什么 浏览:282
蛋白浓缩被超滤管吸附 浏览:205
深圳最好的HEPA过滤网 浏览:127
自来水净化器不用插电和插电怎么选 浏览:987
济宁污水处理社会实践 浏览:840
宝来15用什么机油滤芯 浏览:676
超滤膜的指标 浏览:565
净化器滤网多少颗粒 浏览:319
环氧树脂胶泥 浏览:765
含溴的废水什么颜色 浏览:260
使密斯净水器使用时应用什么模式 浏览:382
净水机水不甜怎么回事 浏览:237
辽源污水处理厂收企业生活污水吗 浏览:805
格美汇净水器滤芯怎么清洗 浏览:972
如何应对日本核废水最新动态 浏览:269
液压滤芯型号怎么看有什么含义 浏览:660
byk环氧树脂分散剂405 浏览:250
净水器通常用什么滤芯组成 浏览:822