怎样限制在表单里输入某些特殊符号?

来源:百度知道 编辑:UC知道 时间:2024/05/13 14:28:35
什么 <iframe 这些了.
怎么限制。 ?
100分.
满意再加50
一楼的大锅..我要的不是这些啊。
是怎样限制在表但里输入 <> 这些字符

写了一个,看看是不是你需要的:
<script>
function chksafe(a)
{
var temp1,temp2,temp3;
temp3="";
fibdn = new Array ("<", ">", "'" ,"\", "、", ",", ";", "/");
i=fibdn.length;
j=a.length;
for (ii=0;ii<i;ii++)
{ for (jj=0;jj<j;jj++)
{ temp1=a.charAt(jj);
temp2=fibdn[ii];
if (temp1==temp2)
{
alert("不能输入: "+temp1);
return a.substr(0,j-1);
}
}
}
return a;
}
</script>
<input name=test onkeyup="this.value=chksafe(this.value)">

把你要限制的字符按同样的格式添加到这行即可:
fibdn = new Array ("<", ">", "'" ,"\", "、", ",", ";", "/");

可以用正则表达式,不过最好在接收表单数据的页面检验。

Dim rst As Recordset
Dim rst2 As Recordset
Dim strUser