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 Internet Explorer 5.5. 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.
In Microsoft 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.
Examples
This example uses the mergeAttributes method to copy attributes, events, and styles from one object to another.
Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/mergeAttributes.htm
<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="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()" >
See also
- 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=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
- 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
- Reference
- clearAttributes
- Conceptual
- About the W3C Document Object Model