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
click
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:
contains
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.
getAttribute
the getAttribute
method can be used to retrieve the value of a specific attribute for the referenced element. For example:
varCol=document.all.MySpan.getAttribute("BGCOLOR",false)
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.
insertAdjacentHTML
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:
BeforeBegin
AfterBegin
BeforeEnd
AfterEnd
insertAdjacentText
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
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'.
scrollIntoView
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.
setAttribute
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.
© 1995-1998, Stephen Le Hunte
Questions:
Comments:
you're info on javascript and html (xul, xhtml, etc...) is very helpful. We use the firefox browser at GDG (and at home), and you'll be happy to know that the statement at the topJames Newton replies: Thanks for the info... P.S. there is a time stamp at the bottom.+
(reading:"All of the following methods are specific to Internet Explorer 4.0's Dynamic HTML object model. None are supported by Netscape")
is no longer needed, as of netscape 6.5, mozilla 1.7, and firefox 1.0. It just took a bit for netscape to recover from the AOL/Sun nightmare. There still may be subtle differences in how layers are displayed but there are other sites you can link to for that.
happy coding!
Btrue
PS a 'last updated' time-date stamp at the bottom would be helpful.
file: /Techref/language/html/ib/Dynamic_HTML/dhtmlm.htm, 9KB, , updated: 2010/9/7 22:33, local time: 2024/12/24 21:43,
3.138.178.162:LOG IN
|
©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? <A HREF="http://linistepper.com/techref/language/html/ib/Dynamic_HTML/dhtmlm.htm"> Dynamic HTML standard Methods</A> |
Did you find what you needed? |