[Project_owners] How to insert text as HTML?

Eric Jung grimholtz at yahoo.com
Mon Aug 29 15:45:15 EDT 2005


Use the DOM Core Level 1 API
http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html

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);
myDiv.appendChild(link);



--- Michael Vincent <mv_van_rantwijk at yahoo.com> wrote:

> Hi,
> 
> I have a string with HTML code that I need to insert in a HTML
> document, 
> 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
> be 
> HTML i.e. a true link, not the above text!
> 
> Thanks for your help/tips,
> Michael
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Project_owners mailing list