Copies all read/write attributes to the specified element.
Syntax
object.mergeAttributes(oSource [, bPreserve])
Parameters
| oSource |
Required.
Pointer to an Object that specifies the attributes copied to the object that invokes mergeAttributes. |
| bPreserve |
Optional.
Available as of Microsoft Internet Explorer 5.5. Pointer to a Boolean that specifies one of the following values: - true
- Default. Preserve the identity of the object to which attributes are being merged.
false- Do not preserve the identity of the object to which attributes are being merged.
|
Return Value
No return value.
Remarks
The
mergeAttributes method copies persistent HTML attributes, events, and styles.
In
Internet Explorer 5 and earlier, attributes that are read-only
, such as
ID,
are not merged.
As of
Internet Explorer 5.5, by choosing not to preserve the identity of the destination object, you can merge all attributes of an object
, including
ID and
NAME.
Example
This example uses the mergeAttributes method to copy attributes, events, and styles from one object to another.
<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()"
>
Code example:
http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/mergeAttributes.htm
Standards Information
There is no public standard that applies to this method.
Applies To
|
A,
ABBR,
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,
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,
Element Constructor |
See Also