I recently wrote a small Web
ProgramThe format of an input value is verified, for example, whether it is a number, whether it is a positive number, or whether it is an integer.
Because the input data in the input box is arbitrary, such as letters
Although the history of using lengthy and annoying code blocks in JavaScript to mark specific browsers has ended, however, it is necessary to occasionally use some simple code blocks and object detection to ensure that some code works normally on
! Remove spaces at both ends of a string
If you use the traditional method, you may need to use the following method.// Clear spaces on the leftFunction js_ltrim (deststr){If (deststr = NULL) Return "";VaR Pos = 0;VaR retstr = new string (deststr
1. You can write various assignment statements in your work.For example, the most common obj. style. display = "none ";If there are more than one assignment statement, obj. style will be dizzy in a row.
The following extend functions in my base. js
Original: http://topic.csdn.net/u/20100421/16/817ef7c6-6675-49e1-bf39-b4a96c08b41e.html
1,Convert string to numeric value
General MethodCode:
Var a = parseFloat ("12 ");
Var B = parseInt ("34 ");
AvailableCode:
Var a = + ("12 ");
Var B = + ("3
OperatorUnaryBase unary operator base type
File: OperatorUnaryBase. js
Function OperatorUnaryBase () { this. deriveFrom (new OperatorBase (); this. set_ClassName ("OperatorUnaryBase"); this. _ type = new UnaryType ("undefined"); };
Character string combinations are often used during software development. Let's take a look at a common character string combination:
Var strName = 'zhang san ';
Var strTableName = 'mytable ';
Var strSql = "select * from" + strTableName + "where
When the query string is used in the url, the square question is translated and some related information is checked. Basically, the server that uses js is used. encode (); server. decode (); Use the url for sending and receiving
Write a javascript timer
Requirement:
Write a javascript timer: it shocould alert a diert after certain timer, the dialog has two buttons. click one of them, the page will refresh automatically; click the other, nothing will happen.
Deploy it on
Based on prototype. js, v1.6
It is hard to understand how to dynamically bind events to elements. I found the bind method on the Internet, and it is difficult to understand when the dynamic binding method needs to add parameters.Using this method
VaR JS = Document. createelement ("script ");
JS. ID = "tmpjs ";
JS. src = "/prototype. js ";
Document. getelementsbytagname ("head") [0]. appendchild (JS );
In this way, if alert (prototype) is enabled immediately, the prototype is undefined.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service