Home > Web Front-end > JS Tutorial > body text

Introduction to JavaScript document object

不言
Release: 2018-07-05 17:39:43
Original
2624 people have browsed it

This article mainly introduces the introduction of JavaScript document object, which has certain reference value. Now I share it with everyone. Friends in need can refer to it

1. The document object is a window object The sub-object can be used directly, mostly used to obtain HTML page elements

2.document object properties

a) alinkColor active link color

b) linkColor Text link color

c) vlinkColor The text color of the document link that the user has observed

d) Cookie information stored in the client

  ①.Yes Some web sites store some of the user's information in small text files on the customer's hard drive

  ②. Cookies can record the user's user name, password, web pages browsed, length of stay, etc. It is convenient for users to operate again

   ③. The information in the cookie is stored in the form of "key-value" pairs; and its information can only be characters in URL encoding. If there is Chinese, the Chinese characters need to be converted, that is, on the client The stored cookie can only contain information composed of numbers and letters

  ④. If you want to delete the cookie, you can modify its date so that it will automatically expire

3.Document object method

a) Clear the specified document content--not recommended to use

①.docObj.clear()--no parameters, no return value

②.Close the document stream When the document stream is opened again, the document content will be automatically cleared

b) Close the document stream

①.docObj.close()--no parameters, no return value

②. After the page is loaded, this method will be automatically executed

③. When the write() method is called to dynamically generate the page, if there is no close() method, the system will wait forever

④. When it is a window When adding an onload event, the onload event will not be triggered without calling the close() method

c) Open the document stream

①.docObj.open([arg])--arg represents MIME type of output stream, default text/html; no return value

d) Write text to document

①.docObj.write(htmlStr)

②.Required Use close() to close the output stream after outputting the completed content; otherwise, the output content will be appended when the write() method is called again

e) Write the text into the document and wrap it in a new line

①.docObj .writeln(str)

The above is the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

Introduction to getters and setters in JavaScript

Convert URL to JSON format

The above is the detailed content of Introduction to JavaScript document object. 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