Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #15350
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail |
|---|---|
| From | Tuxedo <tuxedo@mailinator.com> |
| Newsgroups | comp.lang.javascript |
| Subject | How to create nested elements with createElement(...)? |
| Date | Mon, 13 Aug 2012 22:19:20 +0200 |
| Organization | albasani.net |
| Lines | 16 |
| Message-ID | <k0bng9$8it$1@news.albasani.net> (permalink) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 8Bit |
| X-Trace | news.albasani.net CdIeyDtloj39KTZC+Z3eiDKtqANdj3ysi7P+OBmvbd7pEvgpfdLgmAU8AjqjH8Dz3iLOy1UqhdHvZc2v9cFx8htkRGH9MeNM5Dm1pTkpjB1v7E4OdiqfZOIwteL64R1/ |
| NNTP-Posting-Date | Mon, 13 Aug 2012 20:19:21 +0000 (UTC) |
| Injection-Info | news.albasani.net; logging-data="M6YaJL2zfttFSF5tyZZiCOjEpryO4KJGAtrTPTJiNlkcs2xvH0FC5MSPNFs1BiMvP2rkZnouN8xmL3RGHBRnuDnIUJwB2P+YThbvlKz25ZzUCX3PLYWbOF48xSaBOW+i"; mail-complaints-to="abuse@albasani.net" |
| Cancel-Lock | sha1:axT/trhsPfCriEyAcAVZ8Q9QN8g= |
| Xref | csiph.com comp.lang.javascript:15350 |
Show key headers only | View raw
This appends an image to the body:
function appendElement(){
var img = document.createElement("img");
img.src = 'image.png';
document.body.appendChild(img);
}
How can the same function be made also to create a <div>, so that the div
contains the image, or for a div to be appended to the body and for the
image to be appended to appear within the div?
Many thanks for any advise,
Tuxedo
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
How to create nested elements with createElement(...)? Tuxedo <tuxedo@mailinator.com> - 2012-08-13 22:19 +0200
Re: How to create nested elements with createElement(...)? "Tom de Neef" <tdeneef@qolor.nl> - 2012-08-13 23:06 +0200
Re: How to create nested elements with createElement(...)? Andrew Poulos <ap_prog@hotmail.com> - 2012-08-14 07:08 +1000
Re: How to create nested elements with createElement(...)? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-16 03:42 +0200
csiph-web