Home | Top | Free Ajax Editor | JavaScript Editor | ![]() | Get Advanced JavaScript and Ajax Editor, Validator and Debugger! 1st JavaScript Editor. |
Appends an element as a child to the object .
What's New for Microsoft® Internet Explorer 6This method now applies to the attribute object.
Syntax
oElement = object .appendChild( oNode )Parameters
oNode | Required. Object that specifies the element to append. |
Return Value
Returns a reference to the element that is appended to the object.
Remarks
The appendChild method appends elements to the end of the childNodes collection.
To display new elements on the page, you must append them within the body element. For example, the following syntax demonstrates how to add a div element to the body . var oDiv=document.createElement("DIV"); document.body. appendChild (oDiv);
This method is accessible at run time. If elements are removed at run time, before the closing tag is parsed, areas of the document might not render.
Example
This example uses the appendChild method to add an item to an unordered list.
<SCRIPT>
Standards Information
This method is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 .
Applies To
|
A , ACRONYM , ADDRESS , attribute , B , BDO , BIG , BLOCKQUOTE , BODY , BUTTON , CAPTION , CENTER , CITE , CODE , COL , COLGROUP , COMMENT , DD , DEL , DFN , DIR , DIV , DL , DT , EM , FIELDSET , FONT , FORM , FRAMESET , HEAD , hn , HTML , I , IFRAME , INPUT type=button , INPUT type=checkbox , INPUT type=file , INPUT type=image , INPUT type=password , INPUT type=radio , INPUT type=reset , INPUT type=submit , INPUT type=text , INS , KBD , LABEL , LEGEND , LI , LISTING , MAP , MARQUEE , MENU , nextID , OL , OPTION , P , PLAINTEXT , PRE , Q , S , SAMP , SMALL , SPAN , STRIKE , STRONG , SUB , SUP , TABLE , TBODY , TD , TEXTAREA , TFOOT , TH , THEAD , TR , TT , U , UL , VAR , XMP |
Home | Top | Free Ajax Editor | JavaScript Editor | ![]() | Get Advanced JavaScript and Ajax Editor, Validator and Debugger! 1st JavaScript Editor. |