textContent在Javascript数组中导致无效字符串
如果html表中行的字段3为 所有的“狗”都会上天堂 浏览器控制台将显示以下内部列表(在调用函数filldb()之后)。请注意,表的该行/字段的textContent和结果列表元素中的内部引号不匹配textContent在Javascript数组中导致无效字符串,javascript,html,arrays,html-table,Javascript,Html,Arrays,Html Table,如果html表中行的字段3为 所有的“狗”都会上天堂 浏览器控制台将显示以下内部列表(在调用函数filldb()之后)。请注意,表的该行/字段的textContent和结果列表元素中的内部引号不匹配 ["1", "101", "3/S4.1", "All "dogs' go to heaven.", "4*3*2", "5", "60", "1", "30-00.0", "750.96"] function filldb(){ estRows=[]; rows=e_tbody
["1", "101", "3/S4.1", "All "dogs' go to heaven.", "4*3*2", "5", "60", "1", "30-00.0", "750.96"]
function filldb(){
estRows=[];
rows=e_tbody.rows;
// 'rows' is now the collection of rows in your dynamically output table.
var len=rows.length;
var lnItm=[];
for(var i=0; i<len; i++){
lnItm=[];
lnItm.push(rows[i].cells[0].textcontent);
lnItm.push(rows[i].cells[1].textcontent);
lnItm.push(rows[i].cells[2].textcontent);
lnItm.push(rows[i].cells[3].textcontent);
--- <snip> ---
lnItm.push(rows[i].cells[9].textcontent);
estRows.push(lnItm);
}
for(var i=0; i<len; i++){
console.log(estRows[i]);
}
}
[“1”、“101”、“3/S4.1”、“所有“狗”都能上天堂”、“4*3*2”、“5”、“60”、“1”、“30-00.0”、“750.96”]
函数filldb(){
estRows=[];
行=e_tbody.rows;
//“rows”现在是动态输出表中的行集合。
var len=rows.length;
var lnItm=[];
对于(var i=0;i解析,当然,请参见控制台[“a”,“所有的“狗”都去天堂。”]内部字符串的“
为红色,其他为黑色,这是记录数组时的规则,您可以使用JSON.stringify
将所有内容记录为字符串
var arr=['a']
arr.push(`所有的'狗'都上天堂。`)
控制台日志(arr)
console.log(JSON.stringify(arr))
JavaScript区分大小写->textcontent!==textcontent
“所有的“狗”都会上天堂。”
这句话本应在天堂之后关闭。但在狗之前就关闭了。“所有的“狗”都会上天堂。”
应该像“所有的狗”都会上天堂。”