Click to return to the DHTML, HTML     
lastPage Method     move Method     DHTML Methods    
Web Workshop  |  DHTML, HTML & CSS

mergeAttributes Method

Copies all read/write attributes to the specified element.

Syntax

object.mergeAttributes(oSource)

Parameters

oSourceRequired. Object that specifies the attributes copied to the object that invokes mergeAttributes.

Return Value

No return value.

Remarks

The mergeAttributes method copies persistent HTML attributes, events, and styles. Attributes that are read-only, such as ID, are not merged.

Example

This example uses the mergeAttributes method to copy attributes, events, and styles from one object to another.

Sample Code

<SCRIPT>
function fnMerge(){
   oSource.children[1].mergeAttributes(oSource.children[0]);
}
</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>
<DIV ID="oDiv2">
This is another sample <B>DIV</B> element.
</DIV>
</SPAN>

<INPUT
   TYPE="button"
   VALUE="Merge Attributes"
   onclick="fnMerge()"
>
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:
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

clearAttributes



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.