Re: Add content to existing div



question.boy@xxxxxxxxxxx writes:

I have been trying to find an example of how-to add html text to an
exisiting div and have had little success.

The best I found so far was

var pTag = document.createElement("p");
pTag.innerHTML = noBlanks[i]+" is a mandatory field.";
document.getElementById("FormErrors").appendChild(pTag);

However, I was hoping I could pass HTML code and not just text,
something more like

"New line added.<br />"

or anyother HTML Tag I may need to use.

You can.

Also, the code only seems to work in IE and not Firefox...?

Ther error is somewhere else. This should work in FF; most browsers
support innerHTML, even though it's not officially standard.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
.



Relevant Pages

  • Re: Printing from OE6
    ... Success. ... The reset of the browser settings solved the problem. ... HTML Code May Be Printed Instead of Web Page or Message ... also try resetting IE as the default browser. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Add content to existing div
    ... exisiting div and have had little success. ... However, I was hoping I could pass HTML code and not just text, ...
    (comp.lang.javascript)