2

Evaluate or view HTML using Javascript

 3 years ago
source link: https://www.codesd.com/item/evaluate-or-view-html-using-javascript.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Evaluate or view HTML using Javascript

advertisements

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.google.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(/</g,"<"); and description.replace(/>/g,">");


It could be that the > and the < have been encoded like > and <

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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK