Javascript| Chinese Characters | Web page
First, verify the form:
<form action= "orginsert.jsp" name= "F1" language= "JavaScript" >
<input type= "text" name= "dep"/>
Second, we write JavaScript to embed HTML in the following code:
<script language= "JavaScript" >
function F1_submit () {
if (document.f1.dep.value== "")
{
Alert ("Sorry, department name no input!")
Document.f1.dep.focus ()
return False
}
if (document.f1.dep.value.length>12)
{
Alert ("Sorry, the name of the incoming section is long!")
Document.f1.dep.focus ()
return False
}
if (document.f1.dep.value!= ' AB ')
NULL is NULL to judge num Digit AB letter chs Chinese character bit number
{
Alert ("Sorry, please enter the name of the door is called" Hans!)
Document.f1.dep.focus ()
return False
}
}
</script>
Third, I have written a simple analysis of JavaScript, note that the matching JavaScript statement does not have a semicolon!
Today, the organization architecture module, including a thorough page art, and Drop-down menu for the dynamic Department display. After writing, forget the user input verification, remember, as long as the user input, you need to verify:
1. Null or void
2. Are Chinese characters, numbers, letters
3. Include Special HTML characters
Even mail address verification, call number verification, fixed format verification, and so on ... As if using regular expressions, this is also very important, later to learn.