Copies all read/write attributes to the specified element.
Syntax
object.mergeAttributes(oSource)
Parameters
oSource Required. 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()" >
Applies To
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