The code is as follows
Copy Code
/** Base64 Code*/var base64encodechars = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/";var base64decodechars = new Array (-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
In HTML5, a new geography API is added to identify and share geographic locations.
Privacy StatementPrivacy is a concern when you share a physical location with a remote Web server. Therefore, the Geography API requires users to provide permissions
Each () is used to iterate through each element and make the appropriate processing, the following is a simple implementation:
Method One (direct function call):
The code is as follows
Copy Code
function each (OBJ,FN)
In JavaScript, instantiating an object uses the New keyword.
People often ask me when to use the New keyword for a function.
Before you answer this question, you need to understand the nature of new and what the new action does when invoking the
Anonymous functions are functions that have no names, and closures are functions that can access variables in a function's scope.
A anonymous functions
The code is as follows
Copy Code
normal functionfunction box ()
Many of the frameworks have a parent-child relationship that is cumbersome to operate, and many students often have this sad code:
The code is as follows
Copy Code
Window.parent.document.getElementById ("main").
1, get the current JS file path in jquery
In jquery to get the current JS file path is relatively simple, only need the following line of code to be done.
var __file__ = $ ("script"). Last (). attr ("src");
Note that we typically place this line
Error prompted unterminated string literal, mainly because the output in JS contains N. The solution is to first take the data in the following way to remove N, and then pass the value of JS.
The code is as follows
Copy Code
Similarly, we can imagine that the 1/3 result should be 0.3333333333333333.To get the results we want, we need to correct this value.
In JS, the parsefloat function can be used to convert strings into floating-point numbers. We can use the parseint
1, AppendChild
Adds a node to an array of child nodes of the specified node
Usage: target.appendchild (newchild)Newchild inserts the last child node as a child node of target
Take a look at this simple example: Add a child node div at the end of
Web page effects settimeout and SetInterval Execute command function method periodically
settimeout (expression, delay time)At execution time, after the specified time is delayed, the expression is executed once, remembering that the number is once
If you want to convert number to string, you can use the ToString () method of number, (like (1). ToString () parentheses must or 1. ToString () spaces must otherwise compile an error, if the variable is not required, Or you can call the string ()
GrammarStringobject.indexof (Searchvalue,fromindex)
DescriptionThis method retrieves the string stringobject from beginning to end to see if it contains substring searchvalue. The location at which to start retrieving is at the fromindex of
JavaScript indexof function with square
Definitions and usageThe IndexOf () method returns the location of the first occurrence of a specified string value in a string.
GrammarStringobject.indexof (searchvalue,fromindex) parameter
JavaScript Operations Dom Common API summaryText collation of JavaScript operation of some of the Dom's common api, according to its role in order to create, modify, query and other types of api, mainly used to review the basic knowledge, deepen the
Tip: you can modify some code before running Javascript-based WEB editor Sample button Enter the content to edit Another button Click on the button below to select all buttons with the controlRange
// Step 4: sort the columns and related forums. The basic idea is to re-combine the arrays.Function On_OrderUp () {Var CategoryIndex = frmManager. selCategoryName. selectedIndex;Var ForumIndex = frmManager. selForumName. selectedIndex;If
Cart. jsSave it as cart. js and put it in the same directory as the previous html.//------------------------------------------------------------------------------//// File name: cart. js//// Description: Use the javascript function library at the
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