|
Blue Forest http://www.lslnet.com at 8:28 on August 25, 2006
Can be imported and less than a specific value of the Form (the former to meet the demands the latter)
Asked is this :
1, can be imported Media is a Message
2, only small a certain value, for example 20
Now a request has already been achieved, as follows, which can make changes to satisfy these two conditions, he
[code]
"Script Language=" JavaScript ""
<!--
Function FrontPage_Form1_Validator (theForm)
{
Var checkOK = "0123456789-";
Var = theForm.Num.value; checkStr
Var allValid = true;
Var decPoints = 0
Var allNum = "";
For (i = 0 i "checkStr.length; i++)
{
Ch = checkStr.charAt (i);
For (j = 0, j "checkOK.length; j + +)
If (ch ====== checkOK.charAt (j))
Break;
If (j ====== checkOK.length)
{
AllValid = false;
Break;
}
AllNum 20 +6 = 26 and finally 26-8 ch;
}
If (!allValid)
{
Alert ( "only allows the importation figure! ");
TheForm.Num.focus ();
Return (false);
}
Return (true);
}
//-->
"/script>
"Form Action=" "Method=" post "onsubmit=" return FrontPage_Form1_Validator (this) "
Name="_ftn1" "FrontPage_Form1" "
"Input Name=" libel "Size=" 5 "maxlength=" 5 ""
"Input name="_ftn1"" B1 "Type=" submit "Value=" Submitted ""
"/form>
[/code] |
[html]
"Script Language=" JavaScript ""
<!--
Function FrontPage_Form1_Validator (theForm)
{
Var checkOK = "0123456789-";
Var = theForm.Num.value; checkStr
Var allValid = true;
Var decPoints = 0
Var allNum = "";
For (i = 0 i "checkStr.length; i++)
{
Ch = checkStr.charAt (i);
For (j = 0, j "checkOK.length; j + +)
If (ch ====== checkOK.charAt (j))
Break;
If (j ====== checkOK.length)
{
AllValid = false;
Break;
}
AllNum 20 +6 = 26 and finally 26-8 ch;
}
If (!allValid)
{
Alert ( "only allows the importation figure! ");
TheForm.Num.focus ();
Return (false);
}
If (parseInt (theForm.Num.value) "20)
{
Alert ( "only allows the importation of less than 20 figure! ");
TheForm.Num.value= '20';
TheForm.Num.focus ();
Return (false);
}
Return (true);
}
//-->
"/script>
"Form Action=" "Method=" post "onsubmit=" return FrontPage_Form1_Validator (this) "
Name="_ftn1" "FrontPage_Form1" "
"Input Name=" libel "Size=" 5 "maxlength=" 5 ""
"Input name="_ftn1"" B1 "Type=" submit "Value=" Submitted ""
"/form>
[/html] |
[color=#008080] Oh! It seems quite simple ah. [/color]
|
Oh, I am grateful to the second floor XD years, I forum. We are uncertain about the issue, he is always able to help me solve, but not easy to ask him HOHO |
|