Unstoppable Domains

HTML in JavaScript Error

Spaceship Spaceship
Watch

dnout

Established Member
Impact
1
Hi,

I am trying to inclue some HTML in a javascript line, but I am getting errors. This is what I have:

Code:
body="<table width='590' border='0' cellspacing='0' cellpadding='0'>
                <tr>
                  <td style='padding: 10px; border-right: 1px solid #ffffff;' width='235' height='150' valign='bottom' bgcolor='#737375'><span class='slogan'><strong><text</strong></span></td>
                  <td width='355'><img src='images/head_01.jpg' alt=''/></td>
                </tr>
              </table>";

Any ideas why this is?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
javascript doesn't just ignore whitespace like PHP... every carraige return it expects a new statement... so put all the code on one line.

Also, next time you ask for help, you're more likely to get a response if you post the error message instead of just saying "I get errors" :)
 
0
•••
Rather than adding it all to one line you might want to build it over several lines like this:

Code:
body="<table width='590' border='0' cellspacing='0' cellpadding='0'>";
body += "                <tr>";
body += "                 <td style='padding: 10px; border-right: 1px solid #ffffff;' width='235' height='150' valign='bottom' bgcolor='#737375'><span class='slogan'><strong><text</strong></span></td>";
body += "                  <td width='355'><img src='images/head_01.jpg' alt=''/></td>";
body += "                </tr>";
body += "              </table>";
 
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back