Home > Web Front-end > JS Tutorial > In-depth knowledge of JavaScript

In-depth knowledge of JavaScript

php中世界最好的语言
Release: 2018-03-13 13:31:57
Original
1536 people have browsed it

This time I will bring you in-depth JavaScript little knowledge points, Little knowledge points about using JavaScriptWhat are the precautions, the following are practical cases, Let’s take a look.

1. There are 4 methods to get elements on mainstream browsers:

getElementsByName getElementById getElementsByTagName getElementsByClassName There are 4 of them They are all attributes on the document object. They must be called through the document object.

However, getElementsByTagName and getElementsByClassName can also be called through the DOM object (element). They cannot be called. Call getElementById through DOM!!!

##2.var aA = document.getElementsByTagName('a'); aA looks like an array, but it is not. It is a collection of elements. 'length' and other attributes; but you cannot use sort() to sort!

3. Set transparency:

opacity:0.3; //兼容chrome和fffilter:alpha(opacity:30);//兼容低版本的IE
Copy after login

4. Calculate

Math.round(): Rounding;

Math.abs(): Absolute value;
Math.ceil(): Rounding up Math.ceil(3.41) The result is 4, Math.ceil(-- 9.8) The result is -9;
Math.floor(): Round down Math.floor(-0.9) The result is -1;

I believe you have mastered the method after reading the case in this article, and more How exciting, please pay attention to other related articles on php Chinese website!

Recommended reading:

In-depth basic application of JavaScript

##8 basic knowledge that must be paid attention to in JS

The above is the detailed content of In-depth knowledge of JavaScript. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template