EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.

mergeAttributes method

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:

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

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
bgSound
blockQuote
body
br
button
caption
cite
code
col
colGroup
comment
custom
dd
del
dfn
div
dl
dt
em
embed
fieldSet
form
frame
head
hn
hr
html
i
iframe
img
input type=button
input type=checkbox
input type=email
input type=file
input type=hidden
input type=image
input type=number
input type=password
input type=radio
input type=range
input type=reset
input type=search
input type=submit
input type=tel
input type=text
input type=url
ins
kbd
label
legend
li
link
map
menu
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

 

 

Afficher:
© 2014 Microsoft. Tous droits réservés.