用JavaScript来实现一些简单的控件验证
页面一:
<html>
<head>
<title> 验证与提交一 </title>
<script>
function focusSelect(ID) //当验证不能通过时获得验证控件的焦点和内容
{
document.getElementById(ID).focus();
document.getElementById(ID).select();
}
function txtNameOnBlur() //对用户名的所有验证
{
var txt=document.getElementById("txtName").value;
if(txt=="")
{
document.getElementById("fName").innerHTML="*";
//focusSelect('txtName');
return false;
}else
{
if(isNaN(txt))
{
document.getElementById("fName").innerHTML="用户名必须是数字!";
//focusSelect('txtName');
return false;
}else
if(txt.length!=10)
{
document.getElementById("fName").innerHTML="用户名必须是10位";
//focusSelect('txtName');
return false;
}else
if(txt.substr(txt.length-3,txt.length+1) != "321")
{
document.getElementById("fName").innerHTML="用户名后3位必须是321!";
//focusSelect('txtName');
return false;
}
}
return true;
}
相关文档:
1.如何获取表单<select>域的选择部分的文本?
<form name="a">
<select name="a" size="1" onchange="_sel(this)">
<option value="a">1</option>
<option value="b">2</option>
<option value="c">3</option>
< ......
<a href="<%=Request.ServerVariables("HTTP_REFERER")%>">返回上一步</a>
1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)><td>no</table ......
This document is for establishing build standard for JavaScript and CSS compression
The objective for this document is to establish a companywide JavaScript and CSS compression standard that can be shared crossing multiple SharePoint product development projects. This is the first draft
Overview ......
<!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" />
......
(function() {
var table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63 ......