onblur="return name();"
function name()
{
tChk = /^[^ \s~!@#$%\^\&\*\(\)_\+|\-\=\/\?:;'"\[\{\]\}`\.> <\\]+$/;
if(!tChk.exec(document.form2.title.value))
{
alert("不应许输入特殊符号");
return false;
}
retrun ture;
}
function name()
{
tChk = /^[^ \s~!@#$%\^\&\*\(\)_\+|\-\=\/\?:;'"\[\{\]\}`\.> <\\]+$/;
if(!tChk.exec(document.form2.title.value))
{
alert("不应许输入特殊符号");
return false;
}
retrun ture;
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Untitled Document</title>
</head>
<body>
<script type="text/javascript">
function name2()
{
tChk = /^[^ \s~!@#$%\^\&\*\(\)_\+|\-\=\/\?:;'"\[\{\]\}`\.> <\\]+$/;
if(!tChk.test(document.getElementById("title").value))
{
alert("标题不应许输入特殊符号");
return false;
}
else
{return true}
} function name1()
{
tChk = /^[^ \s~!@#$%\^\&\*\(\)_\+|\-\=\/\?:;'"\[\{\]\}`\.> <\\]+$/;
if(!tChk.test(document.getElementById("content").value))
{
alert("不应许输入特殊符号");
return false;
}
else
{return true}}
</script>
<form action="1.html" name="form2" method="post" onsubmit="return(name2()&&name1())">
<div align="center">
<table width="363" height="350" border="1" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"> <table width="359" height="323" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="67" height="22"> <div align="center">标题: </div> </td>
<td width="292" align="left"> <input type="text" name="title" id="title" value="" onblur="name()"/> </td>
</tr>
<tr>
<td height="22"> <div align="center">ip: </div> </td>
<td align="left"> <input type="text" name="ip" value="" readonly/> </td>
</tr>
<tr>
<td valign="top"> <div align="center">内容: </div> </td>
<td valign="top"> <textarea name="textarea" cols="39" rows="21" value="" id="content"> </textarea> </td>
</tr>
<tr>
<td colspan="2" valign="top"> <div align="center">
<input type="Submit" name="Submit" value="投诉"/>
</div> </td> </tr> </table> </td> </tr> </table> </div> </form>
</body>
</html>