views:

95

answers:

2

At my wits end here , any help appreciated

In my json javascript live pull I have

    html += "<tr><td width=60 valign=top><a href='"+item.url+"' target='_blank'>"+item.site+"</a></td>";

The += seems to strip out my tr td values So I tried amending it to = which just seems to fail.. I tried setting td as a var and still no luck

Any ideas of a way round this, my js is basic so even if you think its silly yyour answer could help me greatly..

EDIT

to confuse things things further the = alone works in FF but on IE the items are loading hidden in the background.. I don't get why the browsers would perform so differently over the use of one + sign...

+1  A: 

x += y is just a shorthand for x = x + y. If you change it to html = "...", you'd be overwriting anything that already existed in the html variable.

How are your "tr td values" being stripped?

Daniel Vandersluis
Clobbered... is that a technical term? ;)
Shaded
Heh, I didn't mean to use it twice in my answer.
Daniel Vandersluis
+3  A: 

try:

html += "<tr><td width=60 valign=top><a href='"+item.url+"' target='_blank'>"+item.site+"</a></td></tr>";

Your markup generated is invalid (not closing the anchor tag) so it's possible the browser isn't interpreting the html very well.

KP
close the <tr> as well
seraphym
good catch missed that one... updated..
KP
that was just a mistake when rewriting it here haha
Webby
You should update your question then as it's misleading. I hope you didn't downvote because of that fact as someone did. You should also consider posting more code than one line as the line in question may not even be the issue at all.
KP
I didn't down vote you, I appreciate the help.. I'm bad at coding but now quite that bad hahah
Webby
Good to hear :) Try posting more of your code so we can help you better..
KP