clearAttributes Method

MS Office DHTML, HTML & CSS

 
Click to return to the DHTML, HTML & CSS home page    
clear Method     clearData Method     DHTML Methods    

clearAttributes Method

Removes all attributes and values from the object.

Syntax

object.clearAttributes()

Return Value

No return value.

Remarks

The clearAttributes method only clears persistent HTML attributes. Events, styles, and script-only properties are not affected.

Example

This example uses the clearAttributes method to remove user-defined attributes from an element.

Sample Code

<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()"
>
This feature requires Internet Explorer 5 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
A, ACRONYM, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BDO, BGSOUND, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, custom, DD, DEL, DFN, DIR, DIV, DL, document, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, HEAD, 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, KBD, LABEL, LEGEND, LI, LINK, LISTING, MAP, MARQUEE, MENU, NEXTID, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TT, U, UL, VAR, XMP

See Also

mergeAttributes


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.