15
The Document Object Presentation by Saw Zin Min Tun

The document object

Embed Size (px)

Citation preview

Page 1: The document object

The Document Object

Presentation by Saw Zin Min Tun

Page 2: The document object

The Document Object

• Defining the Document Object• Using the Properties of the Document Object• Using the Methods of the Document Object

Page 3: The document object

Defining the Document Object

• The document object is an object that is created by the browser of each new HTML page(document) that is viewed.

• By doing this, JavaScript gives you access to a number of properties and methods that can affect the document in various ways.

• You have been using the write() method of the document object.

Page 4: The document object

Using the Properties of the Document Object• alinkColor• Anchors• bgColor• dir• fgColor• formName• linkColor

Page 5: The document object

Using the Properties of the Document Object

• URL• vlinkColor

Page 6: The document object

Using the Properties of the Document Object

• alinkColor The alinkColor property holds the value of the active link

color(the color of a link when it is clicked) for the HTML document.

Returns the hexadecimal value of the active link color of the document.

Page 7: The document object

Using the Properties of the Document Object

• Anchors The anchors property is actually an array that is set by the

browser for all the named anchors in a document (such as <A NAME=“top”>).

An array of all the named anchors in the document.

Page 8: The document object

Using the Properties of the Document Object

• bgColor The bgColor property holds the value of the background

color of a Web page. Returns the hexadecimal value of the background color of

the document. Eg: document.bgColor = “lightblue”;

Page 9: The document object

Using the Properties of the Document Object

• dirThe dir property returns a string value that represents the

readin direction of the document.This value can be either ltr(left to right) or rtl(right to left).Eg: document.dir = “rtl/ltr”;

Page 10: The document object

Using the Properties of the Document Object

• fgColor The fgColor property is the equivalent of the regular text color on a

Web page. The “fg” in this property stands for foreground. Returns the hexadecimal value of the default text color of the

document. Eg: document.fbColor

Page 11: The document object

Using the Properties of the Document Object

• formName The formName property isn’t actually a property itself. Any time you name a form, you create a formName property, but

the property is actually the name of the form and not formName.

Page 12: The document object

Using the Properties of the Document Object

• linkColor The linkColor property holds the value of the link color of the

document. Returns the hexadecimal value of the default link color for the

document Eg: document.linkColor = “#0000FF”;

Page 13: The document object

Using the Properties of the Document Object

•URL The URL property holds the value of the full URL of the current

document. This information can be useful if you print it at the bottom of

your HTML page, because it will show the page URL for anyone who prints out your page.

Returns the URL of the current document

Page 14: The document object

Using the Properties of the Document Object

• vlinkColor The vlinkColor property holds the RGB code for the visited link

color on a Web page. Returns the hexadecimal value of the visited link color for the

document. Eg: document.vlinkColor = “#0000FF”;

Page 15: The document object

Thank you!