[Project_owners] How to insert text as HTML?
mv_van_rantwijk at yahoo.com
Wed Aug 31 01:59:08 EDT 2005
Eric Jung wrote:
> Use the DOM Core Level 1 API
> var myDiv = document.getElementById("mydiv");
> var link = document.createElement("a");
> var linkText = document.createTextNode("MultiZilla");
> link .setAttribute("href", "http://multizilla.mozdev.org/");
> link .appendChild(linkText);
Thanks Eric, but I'm afraid that my HTML example snippet was not clear
enough because what I need really is to insert that link inside a <p>
element, at a given position. Lets take this example:
<p>Here's a better test</p>
and the text 'better' should become my link, so how does that work?
> --- Michael Vincent <mv_van_rantwijk at yahoo.com> wrote:
>> I have a string with HTML code that I need to insert in a HTML
>> inside a <div> element, but how should that be done?
>> Lets take this example:
>> "<a href="..">my link</a>"
>> That should be inserted, as HTML, in a <div> element and it should
>> HTML i.e. a true link, not the above text!
>> Thanks for your help/tips,
More information about the Project_owners