Use JavaScript to create page effects

Use JavaScript to create page effects

11. Use JavaScript to create page effects

11.1 DOM Programming

DOM Programming (Document Object Model) Document Object Model

insert image description here

In DOM programming, the entire page is considered as a document object, in which the HTML element is a specific object. The core of DOM is to find the corresponding HTML element object, and then operate it (modify the attributes or style) and generate a new HTML element object.

11.2 Finding Elements in a Page in JS

  • Find the object through the form's name inclusion relationship: document.calForm.num1
  • Get an HTML element object through the id attribute of the HTML element:
  • document.getElementById(id)
  • Get multiple HTML element objects with the same name attribute value through the name attribute of the HTML element. Return an array that stores all objects with the same name attribute. document.getElementsByName(name) Get multiple HTML element objects with the same tag through the tag name of the HTML element.
  • document.getElementsByTagName(tagName)

11.2.1 Dynamic Time

The time displayed on the page is dynamic. When the page is started, the time is displayed. There are two types of time:

Server time (obtained through Java); client time (obtained through JS), displayed according to the time on each client.

insert image description here
insert image description here

11.2.2 Select All or Deselect All Function

insert image description here
insert image description here

This is the end of this article about using JavaScript to create page effects. For more relevant js page creation content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • The order of creating and mounting the vue.js page
  • Nuxt.js routing jump operation (page jump nuxt-link)
  • JS implements special effects of pictures when clicking the mouse on the page
  • Using JSP to implement a simple user login and registration page sample code analysis
  • How to use JSP pages in Spring Boot

<<:  MySQL database table partitioning considerations [recommended]

>>:  Deploy Nginx+Flask+Mongo application using Docker

Recommend

MySQL 8.0.19 Installation Tutorial

Download the installation package from the offici...

Detailed tutorial on installing MySQL 8.0.20 database on CentOS 7

Related reading: MySQL8.0.20 installation tutoria...

Reasons for the sudden drop in MySQL performance

Sometimes you may encounter a situation where a S...

About if contains comma expression in JavaScript

Sometimes you will see English commas ",&quo...

Detailed explanation of adding dotted lines to Vue element tree controls

Table of contents 1. Achieve results 2. Implement...

Linux Centos8 Create CA Certificate Tutorial

Install Required Files Yum install openssl-* -y C...

Solutions to common problems using Elasticsearch

1. Using it with redis will cause Netty startup c...

Teach you how to achieve vertical centering elegantly (recommended)

Preface There are many ways to center horizontall...

MySQL 5.7.18 free installation version configuration tutorial

MySQL 5.7.18 free installation version installati...

Complete steps to solve 403 forbidden in Nginx

The webpage displays 403 Forbidden Nginx (yum ins...

Using HTML+CSS to track mouse movement

As users become more privacy-conscious and take m...

MySQL uses custom functions to recursively query parent ID or child ID

background: In MySQL, if there is a limited level...

Detailed explanation of concat related functions in MySQL

1. concat() function Function: Concatenate multip...

JavaScript ECharts Usage Explanation

I used ECharts when doing a project before. Today...