insertAdjacentHTMLinsertAdjacentHTML*
*Contents  *Index  *Topic Contents
*Previous Topic: inRange
*Next Topic: insertAdjacentText

insertAdjacentHTML

Description

Inserts the given HTML text into the element at the given place. If the text contains HTML tags, the method parses and formats the text as it inserts.

Syntax

object.insertAdjacentHTML(where, text)

ParameterDescription
where String specifying where to insert the HTML text. Can be one of the following:
BeforeBegin Inserts the text immediately before the element.
AfterBegin Inserts the text after the start of the element but before all other content in the element.
BeforeEnd Inserts the text immediately before the end of the element but after all other content in the element.
AfterEnd Inserts the text immediately after the end of the element.
text String specifying the HTML text to insert. The string can be a combination of text and HTML tags. This must be well-formed, valid HTML or this method fails.

Return Value

No return value.

Remarks

You cannot insert text while the document is loading. Wait for the onload event before attempting to call this method.

Applies To

A, ADDRESS, AREA, B, BASEFONT, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CODE, COMMENT, DD, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FONT, FORM, FRAMESET, H1, H2, H3, H4, H5, H6, HR, I, IFRAME, IMG, INPUT, KBD, LABEL, LEGEND, LI, LISTING, MAP, MARQUEE, MENU, OL, OPTION, P, PLAINTEXT, PRE, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, STYLE, SUB, SUP, TD, TEXTAREA, TH, TR, TT, U, UL, VAR, XMP

See Also

insertAdjacentText,innerHTML, outerHTML


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.