KidsLovePC Contact Us
  Home   PHP  Graphics ASP  JavaScript   J2EE  HTML  JAVA   Swing   Webtip  Forums  Lyric  Free sheet music  Ringtones

Best books about Javasript

javascript, javascript detect chinese input formInput an Chinese character in the following input box. If you didn't input Chinese character, you will see the prompt.

Input Chinese Character like: 你好.

javascript, javascript detect chinese input formHow to do it?

You need the following Javascript to detect Chinese character.

<script language="javascript">
//remove empty spaces
function trim(str)
return str.replace(/^\s*|\s*$/g,"");
function test()
if (trim(str)=="")
alert("Input something, Chinese character only");
var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range
var re2 = new RegExp("^[\uE7C7-\uE7F3]*$"); //Chinese character range
str = str.replace(/(^\s*)|(\s*$)/g,'');
if (str == '')
alert("Oh, man, Please input Chinese character.");
if (!(re1.test(str) && (! re2.test(str))))
alert("Oops, Please input Chinese character.");

The next step you need create a Form to accept client input like the following:

<form name="form1" method="post" action="">
<input type="text" name="name">
<input type="submit" name="Submit" value="Submit" onclick="test()">

OK. Done.



Best books about ASP & ASP.Net from Amazon
JavaScript Bible, Fifth Edition (Paperback) JavaScript & DHTML Cookbook (Paperback) JavaScript: The Definitive Guide (Paperback) Beginning JavaScript Second Edition (Paperback) JavaScript: The Complete Reference, Second Edition (Paperback)


Printer Inkjet A Z lyricsLearn ChineseHome|PHP|Swing|HTML|JavaScript|ASP|JAVA|Forum|WebTip|Contact Us
Copyright © All rights reserved(new). Privacy|Copyright
designed by

Please help us cover the web site maintenance fee.
barcode scanner Thermal Printer credit card machine bar code printer