Home >Web Front-end >JS Tutorial >js solves 'options are empty or not an object'
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.