Home > Web Front-end > JS Tutorial > How to use JavaScript to create page effects

How to use JavaScript to create page effects

醉折花枝作酒筹
Release: 2021-04-19 11:04:19
forward
2374 people have browsed it

This article will give you a detailed introduction to how to use JavaScript to create pages. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How to use JavaScript to create page effects

Use JavaScript to create page effects

DOM Programming

DOM Programming (Document Object Model)Document Object Model
How to use JavaScript to create page effects
In DOM programming, the entire page is regarded as a document object, in which the html elements are specific objects. The core of the DOM is to find the corresponding HTML element object, and then perform operations (modification of attributes or styles) You can also generate new HTML element objects

Find elements in the page in JS

Find the object through the name inclusion relationship of the form:

document.calForm.num1
Copy after login

Get it through the id attribute of the HTML element An HTML element object:

document.getElementById(id)
Copy after login

Obtain multiple HTML element objects with the same name attribute value through the name attribute of the HTML element and return an array, which stores all objects with the same name attribute

document.getElementsByName(name)
Copy after login

Get multiple HTML element objects with the same tag through the tag name of the HTML element

document.getElementsByTagName(tagName)
Copy after login

Dynamic time

The time displayed on the page moves dynamically. When the page The time is displayed at startup. The time is divided into two types:

  1. server time (obtained through Java);
  2. client time (obtained through JS), according to the time on each client time to show.
    How to use JavaScript to create page effects
    How to use JavaScript to create page effects

Select all and unselect all functions

How to use JavaScript to create page effects
How to use JavaScript to create page effects

【Recommended Study: javascript advanced tutorial

The above is the detailed content of How to use JavaScript to create page effects. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
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