1. Object
Prototype object
A prototype is an attribute of an object, that is, the prototype attribute. Each object has this internal attribute and is also an object.
Running result: Add prototype Object Property: 10 Add Object Property: 20
Substr Method
Returns a substring of the specified length starting from the specified position.
Stringvar.Substr (Start[,Length])Parameters
Stringvar
Required. String text orStringObject.
Start
Required. The starting position of the required
This tool function has no practical significance, but because EXT's extend method is not well understood, it writes a simplified extend method to help you understand it.
/*****/E = {}; E. extend = function (sub, sup) {// borrow constructor sub.
This method is similar to the innerHTML attribute in JavaScript and can be used to read or set the HTML content in an element. To obtain the content of an element, you can:
1
var p_html = $(p).html(); // Obtain the HTML code of the p
Copy codeThe Code is as follows:$ (Function (){$ ('Input: text: first '). focus (); // focus on the first text boxVar $ indium = $ ('input'); // all input Elements$ Indium. keypress (function (e) {// here, name the function event parameter e, which
When the browser window size changes, the resize event does not work on the Framework. The solution is as follows:
Copy codeThe Code is as follows:$ (Window). resize (function (){Var surH = $ (window). height ();$ (". Pic_conent"). height (surH );}
1. Discard the fractional part and retain the integer part.
ParseInt (5/2)
2. rounded up. If there is a decimal number, add 1 to the integer part.
Math. ceil (5/2)
3. rounding.
Math. round (5/2)
4. Round down
Math. floor (5/2)
Math object MethodFF:
How to Prevent the enter key from submitting a form is actually very simple. Onkeydown = "if (event. keyCode = 13) return false;" write this sentence in the from tag.If you press Enter on the page, you can set the return value to Prevent automatic
Paste jQuery's operations on js objects and arrays: add, delete, modify, and query code.
Copy codeThe Code is as follows:Var WorkList = new Array (); // Array object// The following is a defined entityFunction WorkEx (depart, title, begintime,
Pop-up windows are often used in our daily development or in our daily life. Here we use js to simulate a pop-up window with the same qq message.
Directly paste the Code:
JavaScript code for the pop-up window in the lower right corner of the
/*** Closure Scope*/Fn1 (); // fn1 can be executed and no error is reported. Functions Defined by function func_name () are always initialized first.Function fn1 (){Console. log ("fn1 ");}
Fn2 (); // error: fn2 is not a function/*** If you use the
Introduction in programming, we usually define functions and variables to successfully construct our system. But how does the parser find the data (functions, variables? What happened when we reference the desired object? Many ECMAScript programmers
Closure is a difficult and characteristic of Javascript language. Many advanced applications rely on closures for implementation.
1. What is a closure?The official explanation is: a closure is an expression (usually a function) that has many
Cause: Recently I am working on a drag-and-drop topology. This problem occurs: If the mouse is quickly dragged during the drag operation, the mouse may be out of the scope of the page or even the browser, if the mouse button is released, the
Phpnew blog has a built-in discuz ubb editor. The editor is inserted at the cursor, which is inaccurate on ie11.Today, I analyzed the cause and finally found the cause. The browser written in the js file of the old version is abnormal, so the
Crumpet is a simple responsive front-end framework based on SASS/SCSS, keeping yourHTMLThe code is concise. Use the placeholder selector whenever possible to reduce the size of your HTML Tag without messy HTML code. Quickly creating a website layout
The following code is implemented using jquery.
:
Source code:Copy codeThe Code is as follows: addition and subtraction of js quantity
Quantity: - + Total Price: 28.10
Copy codeThe Code is as follows: front-end payment-if you need to keep it all night, please pay in advance. guaranteed payment-the customer service staff will call you later,Confirm the information required by the warranty. Copy codeThe Code is as
The Code is as follows: functionDrawImage (ImgD) {varflag = false; varimage = newImage (); varmyImgH = 145; // the maximum height of the image you want is varmyImgW = 190; // The maximum image width you want. src = ImgD. src; if (image. width
The jQuery browser determines that jQuery provides a jQuery. browser Method to Determine the available value of the browser: safarioperamsiemozilla For example: if ($. browser. msie) {alert (& quot; MicrosoftInternetExplorer & quot;)} Of course,
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