DIV object (Object/HTML)

An object that represents a <DIV> block level element.

Availability:

DOM level - 1
JavaScript - 1.5
JScript - 3.0
Internet Explorer - 4.0
Netscape - 6.0
Inherits from:Element object
JavaScript syntax:IEmyDIV = myDocument.all.anElementID
IEmyDIV = myDocument.all.tags("DIV")[anIndex]
IEmyDIV = myDocument.all[aName]
-myDIV = myDocument.getElementById(anElementID)
-myDIV = myDocument.getElementsByName(aName)[anIndex]
-myDIV = myDocument.getElementsByTagName("DIV")[anIndex]
HTML syntax:<DIV> ... </DIV>
Argument list:anIndexA reference to an element in a collection
aNameAn associative array reference
anElementIDThe ID value of an Element object
Object properties:align, dataFld, dataFormatAs, dataSrc
Event handlers:onAfterUpdate, onBeforeUpdate, onBlur, onChange, onClick, onDblClick, onDragStart, onFocus, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onResize, onRowEnter, onRowExit, onScroll, onSelectStart

A DIV object is a means of building a block structured organization of a document that is custom-designed. It is yet another means of building a hierarchical model if none of the existing models fits the structure you need. It is also a way of marking out blocks of a document to be treated as a styled area or perhaps a means of dynamically replacing or modifying document content in an easily controlled manner.

The <DIV> tag is a block-level tag. That means that it forces a line break before and after itself.

The example shows how to exchange the style values between two <DIV> blocks.

Warnings:

Example code:

   <HTML>
   <HEAD>
   </HEAD>
   <BODY>
   <DIV ID="ONE" STYLE="background-color:RED">
   The DIV block ONE
   </DIV>
   <DIV ID="TWO" STYLE="background-color:BLUE">
   The DIV block TWO
   </DIV>
   <FORM>
   <INPUT TYPE="button" VALUE="CLICK ME" onClick="clickMe()">
   </FORM>
   <SCRIPT>
   function clickMe()
   {
   myStyle1 = document.all.ONE.style.cssText;
   myStyle2 = document.all.TWO.style.cssText;
   
   document.all.ONE.style.cssText = myStyle2;
   document.all.TWO.style.cssText = myStyle1;
   }
   </SCRIPT>
   </BODY>
   </HTML>

See also:Element object, Hierarchy of objects, Layer object, LayerArray object

PropertyJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
align1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a1 1 n/a n/a-
dataFld1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a1 1 n/a n/aWarning
dataFormatAs1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a1 1 n/a n/aWarning
dataSrc1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a1 1 n/a n/aWarning

Event nameJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
onAfterUpdate n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onBeforeUpdate n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onBlur1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a n/a n/a n/aWarning
onChange1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a n/a n/a n/a-
onClick1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a n/a n/a4.0 4.0Warning
onDblClick1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a n/a n/a4.0 4.0Warning
onDragStart n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onFocus1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a n/a n/a n/aWarning
onHelp n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/aWarning
onKeyDown1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a n/a n/a4.0 4.0Warning
onKeyPress1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a n/a n/a4.0 4.0Warning
onKeyUp1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a n/a n/a4.0 4.0Warning
onMouseDown1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a n/a n/a4.0 4.0Warning
onMouseMove1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a n/a n/a4.0 4.0Warning
onMouseOut1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a n/a n/a4.0 4.0Warning
onMouseOver1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a n/a n/a4.0 4.0Warning
onMouseUp1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a n/a n/a4.0 4.0Warning
onResize1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a n/a n/a n/aWarning
onRowEnter n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onRowExit n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onScroll n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onSelectStart n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-

Inheritance chain:

Element object, Node object