javascript - Can someone help with this self invoking function stuff? -


I was trying to debug this script all day and I have not found anything that much help was appreciated Will go.

I get an error that it is a curly brace or a square brace or a parent is missing and whenever I try to get the value of my options, it is said that x is undefined , But when I input 0 as my index, I can retrieve the opts.value, my question is why x is undefined and what is missing from this script

Prices = (function () {table = document.getElementsByTagName ("Table"); Select = Table [0] .getElementsByTagName ("Select"); (var x = 0; x & lt; = 10; x + +) Opts = new array (); opts = selects [x] .getElementsByTagName ("option") [select [x]. Selectedindex];} return {value: (function () {val = new array}; Var i = 0; i

OK, if that script & lt; Head & gt; Trying to prepare the DOM elements of your document before reading it, unless you are calling it through onload, which you are not showing.

Your second option is & lt; Script & gt; ... & lt; / Script & gt; Just before the closing body on the bottom of my page, though I can not believe 100% that this problem is because you have not posted your HTML, it is a fair estimate if you are getting undefined DOM elements.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -