clearAttributes method
[This documentation is preliminary and is subject to change.]
Removes all attributes and values from the object.
Syntax
object.clearAttributes()Standards information
There are no standards that apply here.
Parameters
This method has no parameters.
Return value
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
The clearAttributes method clears only persistent HTML attributes. The ID attribute, styles, and script-only properties are not affected.
Examples
This example uses the clearAttributes method to remove user-defined attributes from an element.
Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/clearAttributes.htm
<SCRIPT>
function fnClear(){
oSource.children[0].clearAttributes();
}
</SCRIPT>
<SPAN ID=oSource>
<DIV
ID="oDiv"
ATTRIBUTE1="true"
ATTRIBUTE2="true"
onclick="alert('click');"
onmouseover="this.style.color='#0000FF';"
onmouseout="this.style.color='#000000';"
>
This is a sample <b>DIV</b> element.
</DIV>
</SPAN>
<INPUT
TYPE="button"
VALUE="Clear Attributes"
onclick="fnClear()"
>
See also
- a
- abbr
- acronym
- address
- applet
- area
- article
- aside
- b
- base
- baseFont
- bgSound
- big
- blockQuote
- body
- br
- button
- caption
- center
- cite
- code
- col
- colGroup
- comment
- custom
- dd
- del
- dfn
- dir
- div
- dl
- dt
- em
- embed
- fieldSet
- figcaption
- figure
- font
- footer
- form
- frame
- frameSet
- head
- header
- hgroup
- hn
- hr
- html
- i
- iframe
- img
- input type=button
- input type=checkbox
- input type=file
- input type=hidden
- input type=image
- input type=password
- input type=radio
- input type=reset
- input type=submit
- input type=text
- ins
- isIndex
- kbd
- label
- legend
- li
- link
- listing
- map
- mark
- marquee
- menu
- nav
- nextID
- noBR
- noFrames
- noScript
- object
- ol
- option
- p
- plainText
- pre
- q
- rt
- ruby
- s
- samp
- script
- section
- select
- small
- span
- strike
- strong
- style
- sub
- sup
- table
- tBody
- td
- textArea
- tFoot
- th
- tHead
- title
- tr
- tt
- u
- ul
- var
- wbr
- xml
- xmp
- Reference
- mergeAttributes
- Conceptual
- About the W3C Document Object Model
Build date: 3/8/2012
anomaly - unseen effects
This method, in conjunction with the ondragend event, may not fully update runtimeStyle or its closely related currentStyle:
e.g. drag-drop a CLASS=... Object into an Object that specially has JScript ondragend=...clearAttributes() ...
... leaves the Object appearing to have retained its original styles, margins, though the element itself, its style and said runtimeStyle and currentStyle, are either blank or already-inherited from its style-sheeted Object.... and its appearance does not agree with its various-time style specifications....
e.g. drag-drop a CLASS=... Object into an Object that specially has JScript ondragend=...clearAttributes() ...
... leaves the Object appearing to have retained its original styles, margins, though the element itself, its style and said runtimeStyle and currentStyle, are either blank or already-inherited from its style-sheeted Object.... and its appearance does not agree with its various-time style specifications....
- 6/18/2010
- Mr. Raymond Kenneth Petry