Home > Web Front-end > JS Tutorial > js solves 'options are empty or not an object'

js solves 'options are empty or not an object'

PHP中文网
Release: 2016-05-16 18:57:22
Original
1400 people have browsed it

The old prompt script error: "options are empty or not an object", but the object can be obtained using document.form1.xx or document.getElementById.

I encountered a strange problem yesterday when I was doing the IP/PV statistics page. I put a select control on the page. The id of the control is selectMonth but when I use js to dynamically increase its option, The old prompt script error: "options are empty or not an object", but the object can be obtained by using document.form1.xx or document.getElementById.

I have been searching for a long time but can’t find the reason. I have no choice but to take a long way around and put a p where the select control was originally placed, then use js to dynamically create a select, and then put the select in the p.

Originally, I forgot about it, but today I have to add a select control to this page. I really feel sorry for myself if I continue like this. I searched for a long time and checked almost all the relevant files. Finally, I finally I found a js calendar control that dynamically created a control in js. The id of this control is also named selectMonth. It's really dizzying.

Solve the problem and learn from this.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template