Write about Document object in Java Script
https://www.computersprofessor.com/2019/05/write-about-document-object-in-java.html
Document object:
A.A document is a web page that is being
either displayed or created. The document has a number of properties that can
be accessed by java script programs and used to manipulate the content of the
page.
Document object
properties:
Property
|
Description
|
Example
|
AlinkColor
|
It is used to
set and get color for a link
|
Document.alinkColor
|
Anchor
|
It is the
object reference of an anchor contained in the document
|
Document.anchor
|
bgColor
|
It is used to
set or get background color of web page
|
Document.bgColor
|
Cookie
|
It is used to
identify the value of a cookie
|
document.cookie
|
Domain
|
It is used to
get the domain name of the server from which document is loaded
|
document.domain
|
url
|
It is used to
get the url string of current page or document
|
document.url
|
VlinkColor
|
It is used to
get or set the visitedlinkColor
|
document.vlinkColor
|
Forms
|
It returns
array of the object reference of a form object
|
document.forms
|
Image
|
It returns
array of the object reference of an image object
|
document.image
|
Link
|
It is the
object reference of a link object contained in the web page
|
document.link
|
linkColor
|
It is used to
set or get color of a link attribute
|
document.linkColor
|
Lastmodified
|
It is used to
get the time at which the document or web page was lost modified
|
document.lastmodified
|
Title
|
It is used to
set or get title of document using java script
|
document.title
|
|
|
|
Methods
Method
|
Description
|
Example
|
Close()
|
Closes a document
stream opened using document.open()
|
Document.close();
|
Open([mime
type])
|
Open a document
stream
|
Document.open();
|
Writeln(“string”)
|
Writes the
given string on document with new line character at the end
|
Document.writeln(“hello”);
|
Write(“string”)
|
Writes the
given string and document stream
|
Document.write(“hello”);
|
getElementById()
|
This methods
returns the element that has the id attribute with the specified value
|
Document.getElementId(“demo”);
|