如何在javascript中创建脚本里面的HTML表格

时间:2013-04-20 04:55:52

标签: javascript html html5

我有javascript api发送电子邮件,其中我也可以使用html,所以我在其中创建表但它不工作,表不显示。这是我的代码:

<script>
    $(document).ready(function(){
        $("#commandEmail1").click(function() {
            presenter.command("emailSend",{
                "toEmail": "imran.hussain@celeritas-solutions.com",
                "toName": "Celeritas",
                "subject": "email test",
                "body": "Single Attachment",
                "bodyHtml":"<table width="200" border="1"><tr><td>&nbsp;</td><td>&nbsp;</td> </tr><tr> <td>&nbsp;</td><td>&nbsp;</td> </tr></table>",
                 "attachments": [""]
            });
            return false;
        });
    })
</script>

2 个答案:

答案 0 :(得分:1)

在双引号内使用单引号

"<table width='200'...

或者您可以用&quot;

替换里面的双引号

答案 1 :(得分:0)

代码应该是这样的.. 您使用过双引号..

$(document).ready(function(){


$("#commandEmail1").click(function() {


presenter.command("emailSend",{
    "toEmail": "imran.hussain@celeritas-solutions.com",
    "toName": "Celeritas",
    "subject": "email test",
    "body": "Single Attachment",


 "bodyHtml":"<table width='200' border='1'><tr><td>&nbsp;</td><td>&nbsp;</td> </tr><tr> <td>&nbsp;</td><td>&nbsp;</td> </tr></table>
              ",
       "attachments": [""]
         });
     return false;
         });
         })