use*_*955 2 javascript forms internet-explorer action
这是代码.patient是表单名称.
function settarget(page) {
document.getElementById('patient').action = page;
}
Run Code Online (Sandbox Code Playgroud)
来自IE的确切错误消息是:
SCRIPT438: Object doesn't support this property or method
Run Code Online (Sandbox Code Playgroud)
我也试过它引用document.forms[0].action- 同样的错误.
patient任何其他标记的名称都没有重复.
这适用于Chrome和Firefox,但不适用于XP上的IE8或Win7上的IE9.IE中是否存在阻止此操作的安全设置?
DOM元素(由getElementById返回)没有属性action.您需要在元素上设置属性.
document.getElementById('patient').setAttribute('action',page)
Run Code Online (Sandbox Code Playgroud)