亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

無法解決此錯誤:未關閉的字符串

無法解決此錯誤:未關閉的字符串

一只甜甜圈 2021-10-14 15:58:57
我無法解決語法錯誤。未關閉的字符串是我嘗試驗證它時的錯誤。function addNewCultureRow($row, $case, $specimen) {    var $uniqueID = "." + $row + $case + "." + $specimen;    var $tableRows = "<tr><td>" + $row + "<td><input id='localLevel" + $uniqueID + '" type="edit">' +                        "<td><input id='colony" + $uniqueID + '" type="edit">' +                        "<td><input id='description" + $uniqueID + '" type="edit">' +                        "<td><input id='oxidase" + $uniqueID + '" type="edit">' +                        "<td><input id='isolation1" + $uniqueID + '" type="edit">' +                        "<td><input id='isolation2" + $uniqueID + '" type="edit">' +                        "<td><input id='bioChemComments" + $uniqueID + '" type="edit">' +                        "<td><input id='IDMALDI" + $uniqueID + '" type="edit">' +                        "<td><input id='sensiID" + $uniqueID + '" type="edit">' +                        "<td><input id='organism-" + $case + "-" + $specimen + "544' type='select'>" +                        "<td><input id='localComments" + $uniqueID + '" type="edit">' +                        "<td><input id='comments-" + $case + "-" + $specimen + "-544-new' type='edit'>" +                        "<td><input id='result-" + $case + "-" + $specimen + "544-new' type='select'>";    return ($tableRows);}
查看完整描述

3 回答

?
MM們

TA貢獻1886條經驗 獲得超2個贊

我認為這是來自這一行

"<td><input id='colony"

您需要關閉內部報價。


查看完整回答
反對 回復 2021-10-14
?
茅侃侃

TA貢獻1842條經驗 獲得超21個贊

Thakur 在他的回答中是正確的,你有 ' 和 " 混淆了幾次。如果你想在未來避免這種問題,你可能需要考慮使用模板字符串,例如:


var $tableRows = `<tr><td>${$row}<td><input id='localLevel ${$uniqueID}' type="edit">

                <td><input id='colony ${$uniqueID}' type="edit">

                <td><input id='description ${$uniqueID}' type="edit">

                <td><input id='oxidase ${$uniqueID}' type="edit">

                <td><input id='isolation1 ${$uniqueID}' type="edit">

                <td><input id='isolation2 ${$uniqueID}' type="edit">

                <td><input id='bioChemComments ${$uniqueID}' type="edit">

                <td><input id='IDMALDI ${$uniqueID}' type="edit">

                <td><input id='sensiID ${$uniqueID}' type="edit">

                <td><input id='organism-${$case}-${$specimen}-544' type='select'>

                <td><input id='localComments ${$uniqueID}' type="edit">

                <td><input id='comments-${$case}-${$specimen}-544-new' type='edit'>

                <td><input id='result-${$case}-${$specimen}-544-n' type='edit'>

                `;


查看完整回答
反對 回復 2021-10-14
?
米脂

TA貢獻1836條經驗 獲得超3個贊

將所有 '" 反轉為 "' 并且 type="edit" 應該是 type='edit' ,如下所示:


function addNewCultureRow($row, $case, $specimen) {

    var $uniqueID = "." + $row + $case + "." + $specimen;

    var $tableRows = "<tr><td>" + $row + "<td><input id='localLevel" + $uniqueID + "' type='edit'>" +

                        "<td><input id='colony" + $uniqueID + "' type='edit'>" +

                        "<td><input id='description" + $uniqueID + "' type='edit'>" +

                        "<td><input id='oxidase" + $uniqueID + "' type='edit'>" +

                        "<td><input id='isolation1" + $uniqueID + "' type='edit'>" +

                        "<td><input id='isolation2" + $uniqueID + "' type='edit'>" +

                        "<td><input id='bioChemComments" + $uniqueID + "' type='edit'>" +

                        "<td><input id='IDMALDI" + $uniqueID + "' type='edit'>" +

                        "<td><input id='sensiID" + $uniqueID + "' type='edit'>" +

                        "<td><input id='organism-" + $case + "-" + $specimen + "544' type='select'>" +

                        "<td><input id='localComments" + $uniqueID + "' type='edit'>" +

                        "<td><input id='comments-" + $case + "-" + $specimen + "-544-new' type='edit'>" +

                        "<td><input id='result-" + $case + "-" + $specimen + "544-new' type='select'>";

    return ($tableRows);

}


查看完整回答
反對 回復 2021-10-14
  • 3 回答
  • 0 關注
  • 396 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號