I have the current lists obj in
tempobj
I want to get its value, of the selected item.
so I tried
tempobj.option(tempobj.selectedIndex)
and
tempobj.list(tempobj.selectedIndex)
How do I get that?
Printable View
I have the current lists obj in
tempobj
I want to get its value, of the selected item.
so I tried
tempobj.option(tempobj.selectedIndex)
and
tempobj.list(tempobj.selectedIndex)
How do I get that?
Array indexing in JavaScript (as in any other C-syntax language) uses [], so it's
tempobj.options[tempobj.selectedIndex]
ah I see. thanks alot beeee
do capitals matter in java?
cause they really do in perl, and that is an annoyance
How come this doesnt work?
(if the list has '' in the selected item, I want it to speak up)
<!-- Begin
function checkrequired(which) {
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,8)=="required") {if (((tempobj.type=='text'||tempobj.type=='textarea')&&tempobj.value=='')||(tempobj.type.toString(0)==' s'&&tempobj.options[tempobj.selectedIndex].value=='')) {
pass=false;
break;
}
}
}
}
if (!pass) {
shortFieldName=tempobj.name.substring(8,30).toUpperCase();
alert("Please make sure the all required fields are completed.");
return false;
}
else
return true;
}
// End -->
First, remove the Begin and End words, especially the Begin, it might confuse some engines.
Second, capitalization matters in JavaScript (again, like in most C-like languages, the only exception I know is PHP), so you'd better get used to it. It's really not that bad.
Third:
That's invalid code. type is already a string, so toString doesn't do anything. And toString doesn't take arguments. I guess what you want isQuote:
tempobj.type.toString(0)=='s'
tempobj.type[0], right?
oh interesting. thanks ill try that.