[Phpwm] [OT] does javascript prependChild() function exist?

pete graham petegraham1 at gmail.com
Mon Aug 13 13:37:43 BST 2007


I'm writing some javascript which will insert an image at the
beginning of a paragraph. My problem is the image is added to the end
of the paragraph because I'm using appendChild(), here is my code:

var child = document.createElement('img');
child.src = "/img/icon.png";
child.className = "image";
paragraph.appendChild(child);

What function do I need to use to add the image to the start so I get
something like:
<p><img src="/img/icon.png />paragraph text</p>

Also is it possible to view the html that has been created/modified by
the js, if I view source I just see the original html.

Thanks, Pete



More information about the Phpwm mailing list