小编Mus*_*mar的帖子

Javascript多行字符串和Unexpected Token ILLEGAL

我有一个多行字符串模板,它有自己独立的js文件,用于下划线js.然而,无论我怎么逃避换行,我仍然得到:

未捕获的SyntaxError:意外的标记ILLEGAL

将文件加载到浏览器中的第1行.

App.Templates['template1'] = '\

<div data-role="page" data-theme="c" id="" data-title="">\

    <div data-role="content" class="subnav">\

        <table id="day-table" cellpadding="0" cellspacing="0" border="0">\
            <thead class="ui-body-a">\
                <tr>\
                    <th>T</th>\
                    <th>J</th>\
                    <th>H</th>\
                    <th>C</th>\
                </tr>\
            </thead>\
            <tbody>\
            </tbody>\
            <tfoot>\
                <tr>\
                    <td class="total-label" colspan="2">Total:</td>\
                    <td class="total"></td>\
                </tr>\
                <tr>\
                    <td class="btn-row">\
                        <a href="#r" data-role="button" id="add-btn" data-rel="dialog" data-mini="true" data-inline="true" data-icon="add">Add Rows</a>\
                        <a href="#" data-role="button" id="save-btn" data-rel="dialog" data-mini="true" data-inline="true" data-theme="b" data-icon="check">Save</a>\
                    </td>\
                </tr>\
            </tfoot>\
        </table>\

    </div><!--/content-->\

</div><!-- /page -->';
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

javascript string templates multiline underscore.js

9
推荐指数
1
解决办法
1万
查看次数

标签 统计

javascript ×1

multiline ×1

string ×1

templates ×1

underscore.js ×1