【发布时间】:2009-09-30 13:10:08
【问题描述】:
我的 asp.net 页面中有一个来自第三方的小部件。我不能使用嵌套表单,所以我暂时更改 asp.net 的方法和操作以使用小部件。
我有一个 js 方法,我的小部件方法调用中的元素
function changeActionAndMethodOnFormAndSubmit(newAction, newMethod, newName) {
var theForm = document.forms['aspnetForm'];
if (!theForm) {
theForm = document.Form1;
}
theForm.action = newAction;
theForm.method = newMethod;
theForm.name = newName;
theForm.submit();
}
我想在提交表单之前删除页面上的所有输入元素,除了我需要的那些。我知道基于参数 newName 的元素的确切 ID,但现在,假设我试图删除所有 input.id 不为 x 或 y 的输入元素。
【问题讨论】: