please dont rip this site
Standard DHTML Methods

Standard Methods
All of the following methods are specific to Internet Explorer 4.0's Dynamic HTML object model. None are supported by Netscape or any previous versions of Internet Explorer

The click method can be used to 'click' a referenced object through scripting, forcing an onClick event for the particular element. For example, click the top of the following two links and it 'clicks' the second link:

Link 1
Link 2

The contains method can be used to determine whether the referenced element totally encloses (contains) another element. For example:

<P ID="para1">Some <STRONG ID="str1">strong, bold</STRONG> text</P>

alert (para1.contains(str1)) would return true.

the getAttribute method can be used to retrieve the value of a specific attribute for the referenced element. For example:


would retrieve the value of the BGCOLOR attribute of the element whose ID is MySpan. The false argument is a boolean value (i.e. true or false), specifying whether or not the search to find the attribute is case-sensitive or not. 'True' means that the attribute case must match that give in the attribute value, for the getAttribute method to work - the default value is 'false'. Depending on the value of the attribute, the getAttribute method returns either a string, a number, or a variant.

The insertAdjacentHTML method can be used to insert a new HTML element into the document, without removing a previous one (as manipulation of the innerHTML and outerHTML Properties insertAdjacentHTML places the string specified in the second argument, at the position specified in the first argument. For example:

document.all.tags("P").item(1).insertAdjacentHTML("BeforeBegin", "<P>Here's a new paragraph")

would add <P>Here's a new paragraph before the second paragraph in the document. The possible values for the positioning are:

Insert the HTML before the referenced elements opening element.
Insert the HTML after the referenced elements opening element, but before its text content
Insert the HTML before the referenced elements closing element, after its text content.
Insert the HTML after the referenced elements closing element

The insertAdjacentText method is essentially identical to the insertAdjacentHTML method, except that it inserts literal text, regardless of the strings actual content. It takes the same argument set - i.e. (string, position) where position can be one of the four values mentioned above.

removeAttribute can be used to remove an attribute and its associated value from the referenced element. This is subtly different to dynamically setting the attribute property value to nothing. Using the removeAttribute value forces removal of the attribute, as if it had never been set in the first place. The removeAttribute method returns a boolean (i.e. true or false) value depending on whether the attribute was successfully removed or not. Its optional second argument is a boolean value, which specifies whether to use a case-sensitive search to locate the attribute to remove. For example:

bKilldataSrc=dataTable.removeAttribute "DATASRC", "false"

would make the bKilldataSrc true or false, depending on whether the DATASRC attribute was removed from the element referenced by dataTable. The search is case-insensitive. The default value for the case-sensitivity argument, if none is given, is 'true'.

The scrollIntoView method can be used to force the current viewing window to scroll to a referenced element object. It accepts a boolean argument (true or false) which determines whether the window should be scrolled so that the referenced element object is at the top (true) or bottom (false) of the window. For example, the button below will scroll the links given in the click example, so that they're at the bottom of the viewing window.

Like the other *Attribute methods, setAttribute can be used to set the value of a specific attribute for a referenced element. For example:

MyTable.setAttribute "DATASRC", "#Comp1", true

would set the DATASRC attribute to #Comp1 for the element referenced by MyTable. Basically, the first and second arguments for the method specify the attribute and its value to be set, with the third argument being 'true' or 'false', specifying whether case sensitive setting of the attribute is used or not. If this is set to 'true' (the default) and the attribute name you specify for the referenced element has a different case than any existing setting of that attribute, then a new attribute will be created, with the value specified in the value argument.



file: /Techref/language/html/ib/Dynamic_HTML/dhtmlm.htm, 9KB, , updated: 2010/9/7 23:33, local time: 2024/7/15 17:57,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> Dynamic HTML standard Methods</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?


Welcome to!


Welcome to!