Before I've talked about the back of the table returns JSON data to the foreground and traverses the JSON data in the foreground.
Here, directly in JS to create JSON data, and then traverse the use of ~
The creation code is as follows: (a JSON
In the case of data extracted from the database (especially descriptive information) containing special characters, There is an error when converting a JSON string into a JSON object using Json.parse. It is mainly double quotes, carriage return, and
When it comes to table sorting, the first thing to say is the sort of array, because array sorting is the basis for table sorting.
JavaScript provides a sort () method for table sorting by default, which causes arrays in an array to be arranged in
Set the menu by setting a cookie to save the state of the tree menu, and then re-read the cookie when the page loads.
HTML structure of the menu:
One-level cuisine single Two-level vegetables single Level two menu two Level two
The JS string has the Replace () method. However, this method will only replace the first string that is matched to. The following example:
New Document
If you want to replace all of the words, JS does not provide replaceall
Recently, because of work needs, by clicking on an element, dynamically create a DOM element and display, so write some related JS functions, in this record, to make a memo:
/**//* the correlation function that dynamically creates DOM
See a very interesting tag cloud, 3D spherical, compatible IE 8, pro-Test available! No tests were available for other versions. Feel very interesting to take to record down, learning to learn, this article will release me to read the article
Add object parameters to the URL and overwrite JS code If there is one in the original URL
function Addtourl (obj) {var aprotocol = Location.protocol;
var ahost = Location.host;
var apath = Location.pathname;
var asearch = Location.search;
A question to be prepared at the front end of the interview: How to remove duplicates from JavaScript array. As far as I know, Baidu, Tencent, Shanda and so on in the interview has been out of this topic. The problem seems simple, but it's actually
What is the callback function before learning really do not know how to use the JS callback function, the following article in my Learning callback function examples for you to introduce it, have to understand the students do not enter into the
Sometimes referencing other JS, its JS is using the Window.onload event, so that the introduction of the page onload event may not be implemented, how can two run it? In addition to the two of ways to write together, there are other ways
if
This article describes the JS object and JSON string format conversion implementation method, share for everyone to reference. The implementation methods are as follows:
Copy Code code as follows:
In front of the front-end JS
Method One: Using the Charat method under String Object
The CharAt () method returns the character at the specified position.
Copy Code code as follows:
Str.charat (str.length–1)
Note that JavaScript does not have a
JS in the application of regular expression conversion case, the code is very simple, look at the code:
Capitalize the following first letter, other letter lowercase
The following is a capital letter, and other letters are not
This is an imitation Ctrip custom data drop-down selection Select, for some of the more important parameters of the description, easy for beginners
/* *id:id The current plug-in's parent element *data:json the selected data (JSON format)
Html:
Copy Code code as follows:
Js:
Window.onload=function (e) {var Text=document.getelementbyid ("only"), Pattern=/\d/,//pattern match the number key on the letter pattern2=/(9[ 6-9]) | (10[0-5]) |3 (7|9)/,//pattern2
JS gets the data by default is string type, if the operation of numeric value must use parseint to convert to numeric operations.
HTML code:
Copy Code code as follows:
JS Code:
Copy Code code as follows:
$
Drop-down box label in JSP:
Copy Code code as follows:
Multiple= "true" means that multiple selections are supported.
In JS, the way to create items under the Select tab is flexible:
Copy Code code as
For multilingual versions of the project, the foreground uses Easyui to load the Easyui language pack relative to the browser language version, Easyui the default language pack en-US
The code is as follows
//ie
if (navigator.browserlanguage!
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