In many cases we need to get the event source object to make changes to its properties, and there are two ways to get the event source in the event response functionIn the JavaScript event response, there are many situations where we need to get the
Arguments objects
In function code, using special object arguments, developers can access them without explicitly pointing to parameter names.
For example, in the function Sayhi (), the first argument is the message. Arguments[0] Also accesses
For JavaScript to obtain the current mouse coordinates, you have to understand the coordinates of different browsers. The specific code is as follows: code is as follows:
First we put a textbox in the page to put the XML field in. Remember: Do not use label, because if the XML field information has "" This symbol, the page will produce a JS error.
Next, that's the point. To pay the JS code: ?
1 2 3 4 5 6
This article mainly describes the use of JavaScript on the page dynamic time implementation of the example, the need for friends can refer to the following The code is as follows:
This algorithm is for reference only, the small dish basic not understand the advanced algorithm, can only use the most simple thought to express.
The code is as follows:
Finds the first character in a string that is not repeated
Firstuniquechar (
If you call it directly in function A, then the callback function is limited to death. But using a function to do a parameter has the following benefits: when you (b) A function B becomes a callback function, and you can also be a (c) this time,
The code is as follows:
/**
* Get Address bar parameters
*
* @example geturlstring (' id ')
*
* @desc call with the decision to ensure that the program is not error
* var myurl = geturlstring (' id ');
* IF (myurl!= null
First type:
function test (a,b) {
var a = Arguments[0]? Arguments[0]: 1;//The default value of setting parameter A is 1
var B = arguments[1]? ARGUMENTS[1]: 9;//The default value of setting parameter B is 9
return a+b;
It is equivalent to
This article is mainly on the JavaScript style.left and offsetleft usage of the introduction, the need for friends can come to the reference, I hope to help youIf the position of the parent div is defined as relative, and the position of the child
First, substring
SUBSTRING requires at least one argument, the first parameter is the starting position, the second argument optional, and the end position.
Only one parameter:The code is as follows:Two parameters:The code is as follows:
Second,
This article mainly introduces JavaScript through the Carriage return tab switching function, the need for friends can refer to the following There is a project is to do for the chemical plant in the use of the process needs to enter a large
Inside the site will load some JS code, statistics Ah, Baidu ads and so on, the results of the page loading speed is very slow, there is a good solution, you can refer to the following Usually our website will load some JS code, statistics ah,
What is the essence of csstext?
The essence of Csstext is to set the style attribute value of an HTML element.
Csstext How to use?
The code is as follows:document.getElementById ("D1"). Style.csstext = "color:red; font-size:13px; ";
After
operation element positioning element, with JS to implement is a good choice, here is an example, need friends to see
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
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