Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

HTML in JavaScript Error

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
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: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
CryptoExchange.com
Domain Recover

NamePros updates

Quick replies: search, your most used replies, and more on every post
Quick replies are easier to find and use now. The quick reply menu has a search box. Type a few letters to find the reply you want. A...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back