我今天弄个留言板遇到了以下的问题我做那个html过滤的功能,编了一个函数来处理,我一点提交的时候出现了这么一句异常信息:“从客户端(tbContent="<h1></h1>")中检测到有潜在危险的 Request.Form 值”所以我感觉应该在前台处理,所以我又打算弄个javaScript来处理,可是我不知道在那个按钮的什么地方能让他调用这个javaScript..............有点乱。。过程大约是这样:
一点提交按钮,调用javascript的一个函数
函数处理留言的内容
然后把处理好的字符串赋值给 textBox
然后提交给服务器处理
谁能给稍微写个demo,再给讲讲要是有更好的解决以上问题的方案可以给传授一下
谢谢大家
一点提交按钮,调用javascript的一个函数
函数处理留言的内容
然后把处理好的字符串赋值给 textBox
然后提交给服务器处理
谁能给稍微写个demo,再给讲讲要是有更好的解决以上问题的方案可以给传授一下
谢谢大家
解决方案 »
- 不同页面之间怎么调用控件
- 又到山寨学习的时间了,discuz x2.5后台管理静态页
- asp.net 中如何获取这些服务器参数
- 熟悉网页数据采集的朋友进
- 大家有没有试过SQL2005的CLR编写存储过程?
- extjs 实际应用
- asp.net网站布局大家一般怎么设计,传授点技巧。。。
- 请问如何写超级链接列的URL呢?在这个链接列上,我想弹出webform3.aspx.该如何写呢?(
- 求教用.net生成的数据通过ajax返回前端显示的效率问题
- 关于日历控件(Calendar)想和大家讨论一下(在线)
- 把JS+XML写好的HTML放到VS2005的项目中就不可以运行了......
- 在页面加载时,动态绑定控件的属性,如Height,Width
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm4</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script language=vbscript>
function strleach(str)'过滤非法字符函数
dim tempstr
if str="" then exit function
tempstr=replace(str,chr(34),"")' "
tempstr=replace(tempstr,chr(39),"")' '
tempstr=replace(tempstr,chr(60),"")' <
tempstr=replace(tempstr,chr(62),"")' >
tempstr=replace(tempstr,chr(37),"")' %
tempstr=replace(tempstr,chr(38),"")' &
tempstr=replace(tempstr,chr(40),"")' (
tempstr=replace(tempstr,chr(41),"")' )
tempstr=replace(tempstr,chr(59),"")' ;
tempstr=replace(tempstr,chr(43),"")' +
tempstr=replace(tempstr,chr(45),"")' -
tempstr=replace(tempstr,chr(91),"")' [
tempstr=replace(tempstr,chr(93),"")' ]
tempstr=replace(tempstr,chr(123),"")' {
tempstr=replace(tempstr,chr(125),"")' }
strleach=tempstr
end function
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:TextBox id="TextBox1" runat="server" TextMode="MultiLine" Width="304px" Height="144px"></asp:TextBox>
<INPUT type="button" value="Button" onclick="document.getElementById('TextBox1').innerText=strleach(document.getElementById('TextBox1').innerText)">
</form>
</body>
</HTML>