开发者

Evaluate or Show HTML using Javascript

I have this...portion of code in Javascript:

 var description = document.createElement('P');

 description.className='rssBoxDescription';

 description.innerHTML = itemTokens[2];

 div.appendChild(description);

I see that description gets the HTML value and displays as plain HTML coding not as HTML processing it shouldbe ... how to convert this HTML value in description to be appended to div element shown as HTML...which is not showing.

Also it has value something like:

<table><tr><td style="padding: 0 5px"><ahref="xttp://picasaweb.google.com/linktoimagepage"><imgtag style="border:1px solid #5C7FB9" s_rc="xttp://lh3.ggpht.com/imagepath" alt="image.jpg"/></a></td><td valign="top"><font color="#6B6B6B">Date: </font><font color="#333333">Jun 28, 2007 9:00 AM</font><br/><font color=\"#6B6B6B\">Number of Comments on Photo:</font><font color=\"#333333\">0</font><br/><p><ahref="xttp://picasaweb.go开发者_运维百科ogle.com/linktoimage"><font color="#3964C2">View Photo</font></a></p></td></tr></table>

Pls help Anita

@SARFARAZ ... YES...I am using the script on dhtmlgoodies.com/scripts/rss-scroller/js/ajax.js

It worked as :

description.replace(/&amp;lt;/g,"<");

and

description.replace(/&amp;gt;/g,">");


It could be that the > and the < have been encoded like &gt; and &lt;

Try replacing &gt; with > and &lt; with < in itemTokens before assigning it as the DIV innerHTML and see if it works


It seems to be working for me. Try posting entire code including the div that is created dynamically.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜