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

Ubuntu installation graphics driver and cuda tutorial

Table of contents 1. Uninstall the original drive...

A brief discussion on HTML doctype and encoding

DOCTYPE Doctype is used to tell the browser which...

MySQL 8.0.18 installation and configuration method graphic tutorial (linux)

This article records the installation and configu...

Summary of common knowledge points required for MySQL

Table of contents Primary key constraint Unique p...

CSS border half or partially visible implementation code

1. Use pseudo-classes to display half of the Bord...

Mysql inner join on usage examples (must read)

Grammatical rules SELECT column_name(s) FROM tabl...

How to start a transaction in MySQL

Preface This article mainly introduces how to sta...

How to use vuex in Vue project

Table of contents What is Vuex? Vuex usage cycle ...

Kali Linux Vmware virtual machine installation (illustration and text)

Preparation: 1. Install VMware workstation softwa...

Example of Vue uploading files using formData format type

In Vue, we generally have front-end and back-end ...

Teach you step by step to configure MySQL remote access

Preface When using the MySQL database, sometimes ...

How to use the realip module in Nginx basic learning

Preface There are two types of nginx modules, off...

Docker container data volume named mount and anonymous mount issues

Table of contents What is a container data volume...

MySQL database implements OLTP benchmark test based on sysbench

Sysbench is an excellent benchmark tool that can ...