當我在js中解析文本並且想要從多行中檢索(DNA序列)查詢名稱並將其放在段落標籤之間時,它無法正常工作。用javascript解析文本:神祕生成的段落標籤
(的部分)文本文件:
Database: db
22,774 sequences; 12,448,185 total letters
Searching..................................................done
Query= gi|998623327|dbj|LC126440.1| Rhodosporidium sp. 14Y315 genes
for ITS1, 5.8S rRNA, ITS2, partial and complete sequence
(591 letters)
Score E
Sequences producing significant alignments: (bits) Value
的代碼:
(I第一讀線到一個數組)
for(var i = 0; i < lines.length; i++){
var line = lines[i];
if(line.search("Query= ") != -1){
results.innerHTML += " <p class='result_name'> <br>Result name: ";
//the name starts at 7th char
results.innerHTML += line.slice(7);
//take the next line
i++;
// tried to searh for "\n" or "\r" or "\r\n" to end cycle - didn't work
// so instead I put this for the while condition:
while(lines[i].length > 2){
results.innerHTML += lines[i];
i++;
}
//here is where I want the result_name paragraph to end.
results.innerHTML += " </p> <p>Result(s):</p>";
}
}
嘗試改變
標籤由
– Walfrat
更改和刪除
標籤沒有幫助 –