/    Sign up×
Community /Pin to ProfileBookmark

innerHTML corrupts my text

Okay, so I’m trying to set the innerHTML of a <td> tag. This works in other parts of my site just fine, and it DOES set the innerHTML of this particular tag to something SIMILAR to what I tell it…but it doesn’t set it to exactly what I want! I’ve used a bunch of alerts to see what’s going on. Here’s the string I send it:

[code]
<table border=0>
<tr>
<td>Rhodium</td>
<td>
<a href=”javascript.void(0);” onclick=”editTheme(‘Rhodium’, 0);”>Edit</a>
</td>
<td>
<a href=”javascript:void(0);” onclick=”delTheme(‘Rhodium’, ‘Rhodium’, 0);”>Delete</a>
</td>
</tr>
</table>
[/code]

(note that this code in the page is all on one line, I’ve formatted it for your viewing convenience ?)
…and here’s the innerHTML after I use that string to set it…

[code]
<TABLE border=0>

<TBODY>

<TR>

<TD>Rhodium</TD>

<TD><A onclick=”editTheme(‘Rhodium’, 0);” href=”http://68.145.14.56/ComponentRepository/javascript.void(0);”>Edit</A></TD>

<TD><A onclick=”delTheme(‘Rhodium’, ‘Rhodium’, 0);” href=”javascript:void(0);”>Delete</A></TD></TR></TBODY></TABLE>
[/code]

(I haven’t changed the formatting of this snippet at all…which is confusing. The browser has changed the formatting of my code AND screwed it up as follows…)

Upon close inspection you can see that in the first link the href has been changed from

javascript.void(0);

to

[url]http://68.145.14.56/ComponentRepository/javascript.void(0);[/url]

But it hasn’t done that to the second link…what the HELL is going on? Note this isn’t a browser-specific thing, the same thing happens on both IE 6.0 and Firefox 1.5 Beta 1.

Any insight would be MUCH appreciated, this thing is driving me insane.

I hope I’ve been clear about my problem, let me know if you need clarification.

Thanks in advance!
-Juice

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @Juice spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...