HTML in JavaScript Error

SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by Spaceship
Namecheap AuctionsNamecheap Auctions
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
Close
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
Close
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
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back