In js, loops include For loops and while loops. They are not much different, but they will be used more in some places. Next I will introduce you to the usage of JavaScript For While loops.
For
Number of times a piece of code is cyclically
In the eyes of many students, the splice () method may be used to divide strings into arrays. In fact, it can not only implement this function, but also delete or replace array elements, I will introduce it to you below.
Requirement: array arr2 is
Get the execution time of the program. In php, we add a timer at the beginning of the page to the end and then subtract the start time from the end time to the execution time of the program, this method can also be used in js.
The specific JS Code
In js, arrays have many operations, including array creation, sorting, length, value, deletion, access, and other data operation methods. Below I will summarize js Array Operations, for more information, see.
Js array definition:
The Code
The onfirm () method is used to display a dialog box with the specified message and OK and cancel buttons. The cancel button is more than alert. If you click OK, confirm () returns true. If you click the cancel button, confirm () returns false.
In general, I feel that js setAttribute works exactly the same as attr in jquery, but it is simplified in jquery and the work is more powerful. Next I will introduce their usage separately.
SetAttribute (string name, string value): adds a new
Print to print a webpage is a simple task, but sometimes we want to print the content of a specified area. Next I will introduce how to print the webpage code in a specified area using print.
Relatively simple method
Use CSS to define a. noprint
Sort is a built-in method of the array object. You can sort the elements in the array in ascending order. If no parameter is specified for the sort method, array elements are sorted by character encoding data. If you want to sort other types of
In js, cookie operations are related to the storage and clearing time. We only need to set the cookie expiration time to control its storage, below I will summarize some tips for using cookies in js.
Create and store cookies
In this example, we will
I. What does this Article do:
You can use javascript to obtain user operations and modify url parameters to implement certain functions, such as query (a specific query is implemented by a query statement consisting of parameters in the url obtained
Checking users' buttons is a special part of the event processing program. This chapter focuses on solving some very difficult problems and developing a complete table.
The first problem is that there is no standard for button events. According to
What is prototype. js?In case you haven't used the famous prototype. js, let me tell you that prototype. js is a javascript class library written by Sam Stephen enson. This fantastic idea and compatible with standard class libraries can help you
For people who are engaged in or planning to engage in programming, object-oriented is a familiar word. Almost everyone can list some object-oriented programming languages, such as C ++, JAVA, c. In fact, object-oriented thinking is independent of
The Helper House (www.bkjia.com) is too busy to write articles for a long time. There is no time to write complicated things, and you can write the color gradient effect again. The color effect is generally two, the color gradient change and the
The Helper House (www.bkjia.com) Tutorial provides a work und: how to obtain the image height and width of the network address in a Javascript file, simply put, put the image into an auto-scaling DIV, then obtain the DIV. The following figure shows
The Helper House (www.bkjia.com) has written a tutorial.. net program test. The environment variable is set at the beginning. If the result is not correct, copy it to the C: \ windows directory. The result is OK. The following problems are described:
Bkjia.com documentThis tutorial uses DWR (a Java Implementation of AJAX) as the page!
1. The following is the configuration of DWR.
(1) Configure DWRServlet in web. xml as follows:
Reference content is as follows: dwr-invoker
The FireFox and IE scripts are incompatible.
1. Windows. event compatible scripts
Function getEvent () {// get browser events, and be compatible with ie and ff expressions if (document. all) return window. event;
By default, the scroll bars provided by mainstream browsers for html elements are not beautiful, and front-end developers want to beautify them with a uniform style through css. For example, ie can achieve simple beautification through styles. 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