JavaScript Reference/Javascript Methods/appendChild
"appendChild()" Example
<html>
<body>
<script language="javascript">
function function1(){
var myElement = document.createElement("<div style="width:600; height:200;background-color:blue;">www.wbex.ru</div>");
document.all.myBody.appendChild(myElement);
}
</script>
<body id="myBody"><button onclick="function1();">Append child</button></body>
</body>
</html>
"appendChild()" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<a> <acronym> |
| |<address> <applet> |
| |<area> attribute |
| |<b> <base> |
| |<basefont> <bdo> |
| |<big> <blockquote> |
| |<body> <br> |
| |<button> <caption> |
| |<center> <cite> |
| |<code> <col> |
| |<colgroup> <comment> |
| |<dd> <del> |
| |<dfn> <dir> |
| |<div> <dl> |
| |<dt> <em> |
| |<fieldset> <font> |
| |<form> <frame> |
| |<frameset> <head> |
| |<hn> <hr> |
| |<html> <i> |
| |<iframe> <img> |
| |<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> |
| |<isindex> <kbd> |
| |<label> <legend> |
| |<li> <link> |
| |<listing> <map> |
| |<marquee> <menu> |
| |<meta> <noframes> |
| |<noscript> <object> |
| |<ol> <optgroup> |
| |<option> <p> |
| |<param> <plaintext> |
| |<pre> <q> |
| |<s> <samp> |
| |<script> <select> |
| |<small> <span> |
| |<strike> <strong> |
| |<style> <sub> |
| |<sup> <table> |
| |<tbody> <td> |
| |<textarea> <tfoot> |
| |<th> <thead> |
| |<title> <tr> |
| |<tt> <u> |
| |<ul> <var> |
| |<xmp> |
+----------------+--------------------------------------------------------------+
"appendChild()" Syntax, Parameters and Note
Note:
Appends a child element to the HTML element.
Syntax:
attributeName.appendChild(param1) // IE only
document.getElementById("elementID").appendChild(param1)
document.all.elementID.appendChild(param1) // IE only
Parameters:
param1 Required; the element to append.