For simple table sorting, using JavaScript to sort tables can be divided into four steps:
1. Read the node data of the HTML page (convenient data manipulation)
2. Store table content data into an array (using a for loop)
3. call the sort method
Dynamically Delete rows and columns of a table, which is similar to the substring function in string. However, the location where the deletion starts and the length of the deletion can also be found here. It does not include the start position. Its
There are many ways to verify forms, text fields, and integer Decimals in JavaScript. Today, I also wrote a solution to verify decimal places. users do not need to click any button or lose focus. Alert warning to the user. What cannot be entered
1. Use the built-in random number generation method:Math. Random (); // This method generates a floating point number between 0 and 1.Math. Floor (math. Random () * 10 + 1); // 1-10Math. Floor (math. Random () * 24); // 0-23
2. Based on Time,
In jquery, the browser type and version are determined by regular expressions. in version 1.4: function BRS (UA) { UA = UA. tolowercase (); var match =/(WebKit) [//] ([/W.] + )/. exec (UA) | /(opera )(? :. * Version )? [//] ([/W.] + )/. exec (UA)
Use JavaScript to control page JumpFirst look:
Figure S1 uses the select label to directly jump, that is, directly jump after the option is selected, while Figure S2 jumps only after the option is selected and then click "Submit. then there are
Javascript: type conversionWhen a variable is used in an expression, JavaScript automatically converts a type value to another type. That is to say, there can be different types of data combinations in the expression. Javascript completes the type
The code snippet for dynamically creating any input element is as follows: function createelement (tagname, name, type, value){VaR element = NULL;Try{Element = Document. createelement (' ');Element. type = type;Element. value = value;}Catch (E){}If (
Functions of the showmodaldialog function:Open a Child Window and pass data with the parent window. The biggest difference between it and window. Open is that after showmodaldialog opens the child window, the parent window cannot be
Sometimes, we need to control the size of the display window, which can be achieved by clicking the control button in the upper right corner of the window. However, can we achieve this through links on the page? The answer is: yes! See the following
Javascript has many built-in methods to generate a dialog box, such as window. Alert (), window. Confirm (), window. Prompt. However, ie provides more methods to support the dialog box. For example:Showmodaldialog () (ie 4 +
There are several main reasons for the error "Javascript script does not support this attribute or method:
1. The JS function corresponding to the method is not defined, for example, startloop () is not defined in onclick = "startloop ();", or the
Usage: Defer is used to execute the script after the file is loaded, so that the object cannot be found.
In addition, defer is equivalent to executing after the page is completely in, which is equivalent to window. onload, but the application
In program development, a problem occurs: The content of "data table content example" and "corresponding field" needs to be dynamically changed based on the changes in the data table ,:
The data table code is as follows:
Onchange =
When implementing a function, I found a strange problem: JS is not a problem for a single page application, but if masterpage is applied to an external JS file, the object obtained based on the Set ID is always NULL:
********************************
Besides getelementbytagname
untitled document function SS () { var Ss = getfiles (); alert (ss [1]. SD); } function getfiles () { var files = new array (); var inputs = document.
Dom defines a set of standard objects unrelated to browsers and programming languages to operate HTML and XML documents.
DOM: Level 3: 1. Supported by netscape2, 2. Supported by netscape4... 4.5, 3. Supported by w3cdom, and supported by Internet
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