我试图让用户上传一个项目列表来过滤搜索结果表。问题是,并非所有在过滤器列表中没有值的行都第一次被删除,所以为了让程序执行我想要的操作,我需要多次运行它。
附加的代码有效,但我想删除'badWorkAround()'函数
<div align="center">
<script>
function readList() {
var origText = document.getElementById("CusipTextArea").value;
var filterList = origText.split("\n");
var table = document.getElementById("resultsTable");
var rows = table.getElementsByTagName("tr");
for(i = 1; i < rows.length; i++) #first row has the column names so I start at i=1
{
var Found = '0'
for(j = 0; j < filterList.length; j++)
{
if (rows[i].innerHTML.indexOf(filterList[j]) > 0){
Found = '1'
break;
}
}
if (Found != '1'){rows[i].remove();}
}
}
function badWorkAround(){
readList();
readList();
readList();
readList();
readList();
readList();
readList();
readList();
readList();
}
</script>
<textarea id=TextArea>Paste in a list to filter by. One per line please.</textarea><BR>
<button type="button" onclick="return badWorkAround();">Filter by List</button>
</div>