0
我有一个.hta,其中包含一组在表格内动态创建的下拉框。该表从json文件生成。该表看起来像(显然有更多的表,但是这给你一个想法):获取关联单元格onchange的值
output +=
"<td style='display:none' name='expensive' style='background-color:#EDEDED'><center><input id='expensive_box' type='checkbox'></center></td>" +
"<td style='display:none' name='cheap'><center><input id='cheap_box' type='checkbox'></center></td>" +
"<td style='display:none' id='Spdropsyst' name='SPdropsyst'><select class='jumpmenu' name='SpRating' id='SpRating' onchange='writeRate()'><option id='blank' selected='selected'>...</option><option id='accepted' value=''>SP Accepted</option><option id='declined' value=''>SP Declined</option></select></td>";
output +=
"<td id='biz_name'>" + results[i]["Business Name"] + "</td>" +
"<td style='display:none' name='addressCol'>" + results[i]["Address"] + "</td>" +
"<td><center>" + results[i]["City"] + "</center></td>" +
"<td><center>" + results[i]["StateListing"] + "</center></td>";
每一行,然后用
的document.getElementById(“占位符”)的innerHTML =输出写入;
每行都有自己的下拉列表。该平变化的功能是:
function writeRate()
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var write_id = "file to write to here";
alert('The information has been forwarded to the OON Map Team, Thank you!');
var s = fso.OpenTextFile(write_id, 8, true);
alert(write_id);
s.WriteLine(" ");
if (document.getElementById('cheap_box').checked){
s.WriteLine('cheap');
}
if (document.getElementById('expensive_box').checked){
s.WriteLine('expensive');
}
s.Close();
}
现在我所寻找的是当行X的盒子被改变,我希望它抢写出同样的X行的业务名称的文件。因此,如果有人更改drop x,它将写出业务x,如果有人更改,则y将写出业务y。
我在生成表格时将商业名称传递到数组中。所以我确实有:
spArray.push(results[i]["Business Name"];
并且能够调用任何名称,但不能将名称与方框相关联。我怎样才能以最简单的方式完成这件事?
您可以详细说明您的意思:“每一行然后用'.innerHTML = output'写入,任何表元素的innerHTML'在IE中只读(除'td') – Teemu 2015-04-01 06:02:21
不确定你的目标因为它只是将信息写入div标记的占位符,如果你需要更多的代码,我可以做到这一点,只需要让我知道你需要什么部分。 – Aaron 2015-04-01 19:42:52