Hey all,

I got a little further with the following:

var ret=serverFunction(url);
var newsnode=document.getElementById('newsnode');
while(newsnode.firstChild)
newsnode.removeChild(newsnode.firstChild);
var txt = document.createTextNode(ret);
newsnode.appendChild(txt);

1) I got the completed formatted HTML page back from serverFunction in the variable ret.

2) Then I cleared out all the child nodes in the <div>

3) Created a text node

4) Appended the new text to the node.

Except, as those of you more experienced than I already knew, the HTML was not formatted.

I guess that's why some people still prefer innerHTML?

And I guess the only alternative is to create each element, including tags like <strong>, <i>, etc?

So is this common? Format the whole page via JS code?

Yikes!

Thanks for any advice or comments,
Skip

Skip Evans wrote:
Hey,

I see from reading up that innerHTML is not really standard, and not the best way to go. Was not aware of that and from the doc you send am now working on this:

var maincontent=document.getElementById('newsnode');
maincontent.firstChild.nodeValue=ret;

And the node looks like this:

<div id="newsnode">!!main_content!!</div>

But this is not working. I guess the node itself is not the first node? Will keep working at it, but any hint would sure be appreciated.

Incidentally, !!main_content!! is a placeholder value replaced via PHP with the initial content on page load.

Thanks!
Skip


Thierry Koblentz wrote:

Did you try without using innerHTML?
http://www.w3.org/TR/DOM-Level-3-Core/introduction.html




--
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison, WI 53703
608-250-2720
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and versatile
PHP/MySQL, AJAX & DHTML development framework.
http://phpenguin.bigskypenguin.com/


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to