javascript form field submit : Object doesn't support this property or method in IE8

妖精的绣舞 提交于 2019-12-12 04:14:37

问题


i'm getting following error in IE8

Object doesn't support this property or method 

i'm getting this error on following line

fieldName.form.action = 'some action url';

i have alerted fieldName like following

alert(typeof(fieldName));

it alerts 'Object'

anyone have any idea about this?


回答1:


solved the problem by replacing following line

fieldName.form.action = 'some action url';

to

fieldName.form.setAttribute('action','some url');

got answer from here




回答2:


Try this code

document.form_name.action='some url';



回答3:


document.getElementById('IdOfForm').action='some action URL';


来源:https://stackoverflow.com/questions/12243428/javascript-form-field-submit-object-doesnt-support-this-property-or-method-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!