js限制input标签中只能输入中文

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>只能输入中文</title>
</head>
<body>
<input type="text" id="text" onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\u4E00-\u9FA5]/g,''))">
</body>
</html>

 

posted @ 2015-01-14 11:31  |小赵同学|  阅读(6411)  评论(0编辑  收藏  举报