Copies all read/write attributes to the specified element.
Syntax
object.mergeAttributes(mergeThis, pvarFlags)Parameters
- mergeThis [in]
-
Type: IHTMLElement
Pointer to an Object that specifies the attributes copied to the object that invokes mergeAttributes.
- pvarFlags [in, optional]
-
Type: Variant
Available as of a Windows Store app using JavaScript. Pointer to a Boolean that specifies one of the following values:
Return value
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Standards information
There are no standards that apply here.
Remarks
The mergeAttributes method copies persistent HTML attributes, events, and styles.
Examples
This example uses the mergeAttributes method to copy attributes, events, and styles from one object to another.
<script type="text/javascript">
function fnMerge(){
oSource.children[1].mergeAttributes(oSource.children[0]);
}
</script>
<span id="oSource">
<div
id="oDiv"
attribute1="true"
attribute2="true"
onclick="console.log('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()"
>
See also
- a
- abbr
- address
- area
- b
- base
- bdo
- blockQuote
- body
- br
- button
- caption
- cite
- code
- col
- colGroup
- comment
- custom
- dd
- del
- div
- dl
- dt
- em
- embed
- fieldSet
- form
- 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
- map
- object
- ol
- option
- p
- pre
- q
- s
- samp
- script
- select
- small
- span
- strong
- sub
- sup
- table
- tBody
- td
- textArea
- tFoot
- th
- tHead
- title
- tr
- u
- ul
- var
- Reference
- clearAttributes
- Conceptual
- About the W3C Document Object Model
Build date: 11/28/2012