就像问题所说的那样,我正在尝试在模态窗口保持状态时从模态窗口中清除表单。我试过了:
if (myDocument.title == "Modal Window") {
parent.document.getElementById("textbox")
}
(我需要它来处理超过 1 tb 的数据,但只是为了尝试到达那里。没有运气。
它包含在 iFrame 中,所以我尝试了:
if (myDocument.title == "Modal Window") {
var ifr = document.getElementById("iFrame")
var form = ifr.document.getElementById("form")
ClearForm(form)
}
我从另一个 Stack Overflow 答案中窃取的 ClearForm(form) 函数:
function ClearForm(form) {
$(':input', form).each(function () {
var type = this.type;
var id = this.id;
if (type == 'text' && id != 'text2')
this.value = "";
});
}
'text2' 是我们需要保持填充的一个特定 tb。
知道我错过了什么吗?我已经被这个错误困扰了好几个星期了。