473,322 Members | 1,232 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

javascript manipulating html data in string

this is an odd problem that i can't find a solution to.
snippit:
"function("'+id+'","' + Times + '","' + TimeData + '","#FFFFFF"," "," "," ")"

what happens:

function( bgColor=#ffffff hash?,?0?,?7:00:00 ?)? ?,? AM?,?#FFFFFF?,?>


this seems to reorder my code and replace quotes.

now all im doing is writing to the innerHTML tag of a div.
javascript seems to also add the <tbody> tag to any table i create through javascript.

has anyone ran into this before
Aug 15 '08 #1
3 1218
gits
5,390 Expert Mod 4TB
hi ...

to the first problem:

Expand|Select|Wrap|Line Numbers
  1. "function("'+id+'","' + Times + '","' + TimeData + '","#FFFFFF"," "," "," ")"
should rather look like:

Expand|Select|Wrap|Line Numbers
  1. "function(" + "'" + id + "'" + ...
but please show how you really use your code ... probably it would be enough just to escape some quotes or replace doubles with single or vice versa ...

to your second question: yes ... since a table implies to have a tbody javascript's dom-methods work with that. while FF/Mozilla allows you to add rows directly to the table-node IE is more strict in this special case only ;) ... and forces you to append to the tbody ...

kind regards
Aug 16 '08 #2
found the major issue that was causing the error, seemed some quotes didnt match up correctly, that is now fixed.

i am still a little confused at the fact , when you hav ethis issue, java script reformats the string to include the bgcolor inside the onclick event. only reason this is odd because i didn't write it this way and it still occurs. is there anything in java script that would cause this.
Aug 18 '08 #3
gits
5,390 Expert Mod 4TB
it is hard to say what the problem really is here without seeing your entire usage ... typically you have to create the following:

Expand|Select|Wrap|Line Numbers
  1. var s = '\"function foo(param) { alert(param) }; foo(\'bar\');\"';
and asssign that to a html-node's event-handler. now it is important how you do that ... in either case it should come out as something like this:

[HTML]<node onclick="function foo(param) { alert(param) }; foo('bar');"/>[/HTML]
note the use of double and single quotes here ... the script must take care of this.

kind regards
Aug 19 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.