最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How can I fix a "not a function" JavaScript error in Firefox's console? - Stack Overflow

programmeradmin1浏览0评论

The code below works fine in Chrome but does not work in Firefox. The error displayed in the Firefox console is "Error: document.forms.frmCreateNewEmployee.elements is not a function".

document.forms['frmCreateNewEmployee'].elements('employeeType').value = document.getElementById("userType").options[document.getElementById("userType").selectedIndex].value;

How can I resolve this error?

The code below works fine in Chrome but does not work in Firefox. The error displayed in the Firefox console is "Error: document.forms.frmCreateNewEmployee.elements is not a function".

document.forms['frmCreateNewEmployee'].elements('employeeType').value = document.getElementById("userType").options[document.getElementById("userType").selectedIndex].value;

How can I resolve this error?

Share Improve this question edited Nov 7, 2011 at 18:21 KatieK 13.9k19 gold badges78 silver badges91 bronze badges asked Jul 23, 2011 at 7:28 RamanRaman 2,0113 gold badges20 silver badges30 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

Change .elements('employeeType') to .elements['employeeType'] to fix the error.

发布评论

评论列表(0)

  1. 暂无评论