Click to See Complete Forum and Search --> : write code in more than one lines


tiger66
07-02-2003, 10:29 AM
Hello
I am wondering how can I separate my code into more than one lines

eg
when I put my code in one line, it works
req.innerHTML = "<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='650'>
<tr><td>hello</td></tr></table>";

but when I separate into two lines it doesn't work

Thanks

pyro
07-02-2003, 10:31 AM
Try this:

req.innerHTML = "<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='650'>",
"<tr>",
"<td>hello</td>",
"</tr>",
"</table>"; //last line ends with a ;

tiger66
07-02-2003, 10:52 AM
No it doesn't work either
Any other way that can resolve this problem?

Thanks

Charles
07-02-2003, 11:57 AM
req.innerHTML = ["<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='650'>",
"<tr>",
"<td>hello</td>",
"</tr>",
"</table>"].join()

jeffmott
07-02-2003, 12:03 PM
easier still...req.innerHTML = "<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='650'>\
<tr>\
<td>hello</td>\
</tr>\
</table>";

tiger66
07-02-2003, 12:07 PM
for some reason it's outputting all the ','
like the output I got is
,
,
,
,
hello
how could I get rid of those ','?

Thanks

pyro
07-02-2003, 12:28 PM
Did you try jeffmott's suggestion?