-
The functions you want are all here, I won't list the specific syntax, you can go to the Internet to find the relevant usage.
It's actually quite simple to look at other people's programs and then implement them yourself.
Function to determine whether it is a number: isnumeric
asp determines the date format function: date
dateadd function.
Description: Returns the date to which the specified time interval was added.
datediff function.
Description: Returns the time interval between two dates.
datepart function.
Description: Returns a specified section for a given date.
dateserial function.
Description: For the specified year, month, and day, returns the variant of the date subtype.
datevalue function.
Description: Returns a variant of the date subtype.
formatdatetime function.
Description: Returns an expression that has been formatted as a date or time.
hour function.
Description: Returns an integer between 0 and 23 (inclusive) that represents an hour of the day.
minute function.
Description: Returns an integer between 0 and 59 (inclusive) that represents a minute within an hour.
month function.
Description: Returns an integer between 1 and 12 (inclusive) that represents a month of the year.
monthname function.
Description: Returns a string indicating the specified month.
now function.
Description: Returns the current date and time value based on the date and time set by the computer system.
second function.
Description: Returns an integer between 0 and 59 (inclusive) representing a second in a minute.
time function.
Description: Returns the date subtype variant, indicating the current system time.
timeserial function.
Description: Returns a variant of the date subtype, containing the specified hours, minutes, and seconds.
timevalue function.
Description: Returns a variant of the date subtype that contains the time.
weekday function.
Description: Returns an integer representing a day of the week.
year function.
Description: Returns an integer representing a year.
-
There are server scripts that are reused.
j=cint(request("txt1")).
-
That's not true.
A function should be used, isnumeric().
-
To tell you the easiest way to envy the wheel, if you ask to enter only numbers, then limit his input to numbers only.
onkeyup="value=,''Place this paragraph on the input box.
Than Kiri: Try to see if you can also enter characters other than numbers. Hehe, after trying it, you know how cool this method is, except for the number brother wide, he can't input anything, enough yin, right? The bottom line is an increase in efficiency.
Also, if you want to verify, you can use isnummeric
-
Verify the received values.
id=request("Worldwide ID")
if not isnumeric(id) thencall msgbox("ID is the digital surplus silver","back","elseend if
-
This suggestion is handled by JS.
References:Specify in the onkeypress event of the textbox control that the input keycode must be numeric:
48)&&=57))|else" maxlength="15">
Note: If you are not allowed to enter a decimal point, remove the "case."
Or: Similar to Method 1:
if(!=8!!='.')
Similar method two:
if ((48 ||57) (= 8) !='.')
Similar method three:
if (!Explanation: The ISDIGIT function can determine whether the number is from 0 to 9, CHR(8).
If it is true, the program thinks that the keypress event has been processed, and the content of the text box will not change.
If you want to enter a decimal for the text, you need to be able to enter a decimal point. , and the decimal point can only be entered once.
isnumber: specifies whether the characters in the specified position in the string belong to the number category.
ispunctuation: specifies whether the characters in the specified position in the string belong to the punctuation category.
iscontrol: specifies whether the characters in the specified position in the string belong to the control character category.
Note: This restricts other types of characters from being written to the textbox at input time;
That is, if you don't type it correctly or you don't type a number, I won't let you do any other work!
Domineering, right? Hehe, if you don't like this way, there are several below that allow users to enter casually first and then judge, if it's not an integer, I'll give you a warning, tell you that the input type is incorrect, please re-enter!
- But in my opinion, this practice is somewhat unethical, waiting for you to make mistakes.
Similar method four: regular expressions.
string regexp = /^[1-9][0-9]*$/;
if(!Similar method 5: The most imaginative (primitive) judgment method --- to judge one character by one, you need to add a for loop and n if:
function isint(a)
return true;}
-
Hello: When you want to submit, you can determine whether the value in the text box is int or not: use isnan (text box. value) to determine if it is a pure number.
Backstage words: You use.
int i = 0;
bool b = text box. value, out i) ;
If b is true, then it is int and i is equal to (text box. value, if b is false, it is not int
-
When writing a program, you can cast the string type to int!
-
It's best to add a judgment to the action page, or to cint casts, after all, JS can be disabled.
-
if not isnumeric( thenmsgbox"Please enter a number"
exit sub
Next, write the statement that is the number to be implemented.
-
if isnumeric( then
end if
You can use the isnumeric(value) function to determine this.
-
Why don't you set the text box property to a numeric value?
Or check its ASCII code.
-
"05")+cint("05"))
cint("05"): A ********************************************* that converts a string to an integer
Flooring this effect is mainly there:
dim n1,n2
n1 = ""
n2 = ""
n1 = formatnumber(n1,2,-1,0,-1)n2 = formatnumber(n2,2,-1,0,-1)
-
cint(05) +cint(05)
Convert the obtained characters into an integer cint function.
If you're using aspnet, he has a special function in. NET to get a computer name, IP address and current username is very simple, the following are a few methods I commonly use, if you have other good methods, you can reply and sort it out together: >>>More
ASP is an abbreviation for ActiveServerPage, which means "Active Server Web Page". ASP is an application developed by Microsoft to replace CGI scripting programs, which can interact with databases and other programs, and is a simple and convenient programming tool. The format of the asp web page file is: >>>More
For the introduction to programming, of course, choose Chongqing Dane. >>>More
With the advancement of technology, our daily life and social environment have become more and more convenient and rich, and smartphones and the Internet have become an indispensable part of our lives. >>>More
Learning to code well requires a long-term learning plan that includes multiple aspects such as front-end, back-end, databases, programming tools, and programming languages. Learning programming should be based on hands-on exercises, supplemented by reading books and studying. If you want to learn programming well, it is best to find a senior programming teacher and learn with an open mind. >>>More