JavaScript technology often used in B/s development
First, the validation class
1, digital verification within
1.1 Integers
1.2 Integers greater than 0 (for authentication of transmitted IDs)
1.3 Validation of negative integers
1.4 integers cannot be larger than IMAX
1.5 integers cannot be less than imin
2. Time Class
2.1 Short time, shaped like (13:04:06)
2.2 Short date, shaped like (2003-12-05)
2.3 Long time, shape like (2003-12-05-13:04:06)
2.4 Only years and months. Shape (2003-05, or 2003-5)
2.5 Only hours and minutes, shaped like (12:03)
3. Form Category
3.1 The values of all forms cannot be empty
The value of the 3.2 multiline text box cannot be empty.
3.3 Multiline text box value cannot exceed Smaxstrleng
3.4 Multiline text box cannot have less than Smixstrleng value
3.5 Determines whether the radio box is selected.
3.6 Determines whether the check box is selected.
3.7 check box Select all, multi-select, all uncheck, reverse Select
3.8 file types to be judged during upload
4. Character class
4.1 Judging characters are all made up of a-Z or a-Z character letter
4.2 The judging character is made up of letters and numbers.
4.3 The judging character consists of a letter and a number, an underscore, and a dot. And the beginning can only be underlined and letters
4.4 String substitution function. Replace ();
5. Browser class
5.1 Determining the type of browser
5.2 Determining the version of IE
5.3 Determining the resolution of the client
6. Combined class
6.1 e-mail judgment.
6.2 Verification of mobile phone number
Verification of 6.3 ID card
Second, the function class
1. Time and related control classes
1.1 Calendar
1.2 Time Control
13,000 calendar
1.4 Display the dynamic display clock effect (text, such as time in OA)
1.5 Display the dynamic display clock effect (image, like watch)
2. Form Category
2.1 Automatically generate forms
2.2 Dynamically add, modify, delete elements in drop-down boxes
2.3 Drop-down box to enter content
Only IMAX text can be entered in more than 2.4 lines of text box. If more input, automatically reduce to IMAX text (more for text message sending)
3. Printing class
3.1 Print controls
4. Event class
4.1 Shielding Right-click
4.2 Block all function keys
4.3--and <--F5 F11,F9,F1
4.4 Shield Combo Key CTRL + N
5, Web design class
5.1 Continuous scrolling text, picture (note is continuous, two paragraphs of text and no white space appear in the picture)
5.2 HTML Edit Control class
5.3 Color Marquee Control
5.4 Drop-down menu
5.5 Two-level or multiple-level drop-down menu
5.6 A button that imitates the IE menu. (effects such as Rongshuxa.com's navigation section)
5.7 Status bar, the dynamic effect of title bar (many examples can be studied)
5.8 After double click, the webpage scrolls automatically
6. Tree-type structure.
6.1 Asp+sql version
6.2 Asp+xml+sql Version
6.3 Java+sql or Java+sql+xml
7, no border effect of the production
8. Continuous pull-down frame technology
9. Text sorting
First, the validation class
1, digital verification within
1.1 Integers
/^ (-|+) d+$/.test (str)
1.2 Integers greater than 0 (for authentication of transmitted IDs)
/^d+$/.test (str)
1.3 Validation of negative integers
/^-d+$/.test (str)
2. Time Class
2.1 Short time, shaped like (13:04:06)
function Istime (str)
{
var a = Str.match (/^ (d{1,2}) (:)? ( d{1,2}) 2 (d{1,2}) $/);
if (a = = null) {alert (' input parameter is not a time format '); return false;}
if (a[1]>24 | | a[3]>60 | | a[4]>60)
{
Alert ("The time format is incorrect");
return False
}
return true;
}
2.2 Short date, shaped like (2003-12-05)
function Strdatetime (str)
{
var r = Str.match (/^ (d{1,4}) (-|/) (d{1,2}) 2 (d{1,2}) $/);
if (r==null) return false;
var d= new Date (r[1], r[3]-1, r[4]);
Return (D.getfullyear () ==r[1]&& (D.getmonth () +1) ==r[3]&&d.getdate () ==r[4]);
}
2.3 Long time, shape like (2003-12-05-13:04:06)
function Strdatetime (str)
{
var reg =/^ (d{1,4}) (-|/) (d{1,2}) 2 (d{1,2}) (d{1,2}):(d{1,2}):(d{1,2}) $/;
var r = Str.match (reg);
if (r==null) return false;
var d= new Date (r[1], r[3]-1,r[4],r[5],r[6],r[7]);
Return (D.getfullyear () ==r[1]&& (D.getmonth () +1) ==r[3]&&d.getdate () ==r[4]&&d.gethours () = =r[5]&&d.getminutes () ==r[6]&&d.getseconds () ==r[7]);
}
2.4 Only years and months. Shape (2003-05, or 2003-5)
2.5 Only hours and minutes, shaped like (12:03)
3. Form Category
3.1 The values of all forms cannot be empty
<input onblur= "if (This.value.replace (/^s+|s+$/g, ') = =") alert (' cannot be empty! ') " >
The value of the 3.2 multiline text box cannot be empty.
3.3 Multiline text box value cannot exceed Smaxstrleng
3.4 Multiline text box cannot have less than Smixstrleng value
3.5 Determines whether the radio box is selected.
3.6 Determines whether the check box is selected.
3.7 check box Select all, multi-select, all uncheck, reverse Select
3.8 file types to be judged during upload
4. Character class
4.1 Judging characters are all made up of a-Z or a-Z character letter
<input onblur= "if (/[^a-za-z]/g.test (this.value)) alert (' wrong ') ' >
4.2 The judging character is made up of letters and numbers.
<input onblur= "if (/[^0-9a-za-z]/g.test (this.value)) alert (' wrong ') ' >
4.3 The judging character consists of a letter and a number, an underscore, and a dot. And the beginning can only be underlined and letters
/^ ([A-za-z_]{1}) ([w]*) $/g.test (str)
4.4 String substitution function. Replace ();
5. Browser class
5.1 Determining the type of browser
Window.navigator.appName
5.2 Determining the version of IE
Window.navigator.appVersion
5.3 Determining the resolution of the client
Window.screen.height; Window.screen.width;
6. Combined class
6.1 e-mail judgment.
function Ismail (mail)
{
Return (New RegExp (/^w+ (-w+) | (. w+)) *@[a-za-z0-9]+ ((. | -) [a-za-z0-9]+] *. [a-za-z0-9]+$/). Test (mail));
}
6.2 Verification of mobile phone number
Verification of 6.3 ID card
function Isidcardno (num)
{
if (IsNaN (num)) {alert ("input is not a number!") "); return false;}
var len = num.length, re;
if (len = = 15)
Re = new RegExp (/^ (D{6}) ()? ( D{2}) (D{2}) (D{2}) (D{3}) $/);
else if (len = = 18)
Re = new RegExp (/^ (D{6}) ()? ( D{4}) (D{2}) (D{2}) (D{3}) (d) $/);
else {alert ("The number of digits entered is incorrect!") "); return false;}
var a = Num.match (re);
if (A! = null)
{
if (len==15)
{
var D = new Date ("+a[3]+"/"+a[4]+"/"+a[5]");
var B = D.getyear () ==a[3]&& (D.getmonth () +1) ==a[4]&&d.getdate () ==a[5];
}
Else
{
var D = new Date (a[3]+ "/" +a[4]+ "/" +a[5]);
var B = D.getfullyear () ==a[3]&& (D.getmonth () +1) ==a[4]&&d.getdate () ==a[5];
}
if (! B) {alert ("entered ID number" + a[0] + "The Birth date is wrong! "); return false;}
}
return true;
}
3.7 check box select all, Multi-Select, select All, uncheck
<form name=hrong>
<input type=checkbox name=all onclick= "checkall (' mm ')" > Select <br/>
<input type=checkbox name=mm onclick= "Checkitem (' All ')" ><BR/>
<input type= CheckBox name=mm onclick= "Checkitem (' All ')" ><BR/>
<input type=checkbox name=mm onclick= "CheckItem (' All ') "><br/>,
<input type=checkbox name=mm onclick=" Checkitem (' All ') "><BR/>
<input Type=checkbox name=mm onclick= "Checkitem (' All ')" ><BR/><BR/>
<input type=checkbox name=all2 onclick= "Checkall (' mm2 ')" > select all <br/>
<input type=checkbox name=mm2 onclick= "Checkitem (' All2 ')" ><br/>
<input type=checkbox name=mm2 onclick= "Checkitem (' All2 ')" ><br/>
<input type=checkbox name=mm2 onclick= "Checkitem (' All2 ')" ><br/>
<input type=checkbox name=mm2 onclick= "Checkitem (' All2 ')" ><br/>
<input type=checkbox name=mm2 onclick= "Checkitem (' All2 ')" ><br/>
</form>
<script language= "JavaScript" >
function Checkall (str)
{
var a = document.getelementsbyname (str);
var n = a.length;
for (var i=0; i<n; i++)
a[i].checked = window.event.srcElement.checked;
}
function Checkitem (str)
{
var e = window.event.srcElement;
var all = eval ("Document.hrong.") + str);
if (e.checked)
{
var a = Document.getelementsbyname (e.name);
All.checked = true;
for (var i=0; i<a.length; i++)
{
if (!a[i].checked) {all.checked = false; break;}
}
}
else all.checked = false;
}
</SCRIPT>
3.8 file types to be judged during upload
<input type=file onchange= "alert (This.value.match (/^ (. *) (.) (. {1,8}) $/) [3]) ">
Drawing:
<object
Id=s
Style= "left:0px; width:392px; top:0px; height:240px "
height=240
width=392
Classid= "Clsid:369303c2-d7ac-11d0-89d5-00a0c90833e6" >
</OBJECT>
<SCRIPT>
S.drawingsurface.arcdegrees (0,0,0,30,50,60);
S.drawingsurface.arcradians (30,0,0,30,50,60);
S.drawingsurface.line (10,10,100,100);
</SCRIPT>
Transferred from: http://www.blogjava.net/love-java/
[To] the JavaScript technology used in B/s development