|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>禁止文本框输入指定字符并自动清除</title> <meta http-equiv="content-type" content="text/html;charset=gb2312"> </head> <body> <!--把下面代码加到<body>与</body>之间--> 禁止输入“*”、“^”及“|”,输入这些字符将被自动清除:<input onkeyup="this.value=this.value.replace(/[\*\^\|]+/,'');" value="" size="20"> </body> </html> |