I've been trying to debug this script all day and I got nothing any help would be greatly appreciated.
I keep getting an error that it's missing a curly brace or a square brace or a parenthetical. And also when I try to get the value of my options it says x is undefined but when I input 0 as my index I can retrieve opts.value, my question is why is x undefined and what's missing from this script
prices= (function(){
table=document.getElementsByTagName("table");
selects=table[0].getElementsByTagName("select");
for(var x=0;x<=10;x++){
opts=new Array();
opts=selects[x].getElementsByTagName("option")[selects[x].selectedIndex];
}
return{
value: (function(){
val=new Array();
for(var i=0;i<=5;i++){
val[i]=opts.value
}
return val;
})();,
total: (function(){}
var num="$15.00"
var t;
for(var j=0;j<=3;j++){
t+=num.slice(1).valueOf();
}
return t
})();
};
})();
var hello="hello"
document.write("<p>hello</p>");//line just test whether or not function is working
document.write(opts.value);