我有这个 javascript 代码:
var markup = '<tr id="newdo" class="odd"><td>' + @Html.DropDownList("does", new SelectList(Model.Does, "Id", "Name"),new { @class = "newDoSelect" }) + '</td><td class="small">'+ @Html.DropDownList("restriction", Model.Restrictions) + '</td><td>' + @Html.ListBox("doobjectives", new MultiSelectList(Model.AllObjectives, "Id", "Name"), new { Multiple = "multiple", @class="doobjectives" }) + '</td><td></td></tr>';
$('#doList tr:last').after(markup);
这是渲染的代码:
var markup = '<tr id="newdo" class="odd"><td>' + <select class="newDoSelect" id="does_3_" name="does[3]"><option value="319">A breath of fresh air..</option>
<option value="176">Fix something that's broken today!</option>
<option value="179">Get a physical 'high' today!</option>
<option value="150">It's OK to be unassertive sometimes!</option>
<option value="169">Just 'let it wash' today.</option>
<option value="200">WOW!</option>
<option value="233">Write something for 15 minutes.</option>
<option value="104">You CAN be individually-centred: try it today.</option>
<option value="111">You can be livelier: try this.</option>
<option value="77">You can be more definite in how you are.</option>
<option value="58">You don't always have to be unassertive!</option>
</select> + '</td><td class="small">'+ <select id="restriction_3_" name="restriction[3]"><option value="negative">negative</option>
<option value="neutral">neutral</option>
<option value="positive">positive</option>
</select> + '</td><td>' + <select Multiple="multiple" class="doobjectives" id="doobjectives_3_" multiple="multiple" name="doobjectives[3]"><option value="4">another test</option>
<option value="24">testing objective 10</option>
<option value="25">testing objective 11</option>
<option value="13">testing objective 2</option>
<option value="14">testing objective 3</option>
<option value="15">testing objective 4</option>
<option value="16">testing objective 5</option>
<option value="17">testing objective 7</option>
<option value="19">testing objective 8</option>
<option value="18">testing objective 9</option>
</select> + '</td><td></td></tr>';
$('#doList tr:last').after(markup);
它在 Firefox 上运行良好,但在 chrome 上我在第一行收到此错误:
未捕获的 SyntaxError:意外的标识符
有什么线索吗?