var cont = 2;
document.form.datab.options[cont].selected;
Or
var cont = 2;
document.form.datab.selectedIndex = cont;
Get the Best Answers! faq333-2924
"A witty saying proves nothing." - Voltaire
mikewolf@tst-us.com
Here is my code:
Function datobase(){
var cont=0;
for (cont=0; cont<=12; cont++) {
if (document.form.datab.options[cont].selected==true){
if (document.form.db.value==""{
document.form.db.value=document.form.datab.options[cont].value;
}else{
document.form.db.value+=","+document.form.datab.options[cont].value;
}
}
}
}
I recommend against using "form" as a name for your form...
I need to see more code...
if (document.form.datab.selectedIndex == cont){ Get the Best Answers! faq333-2924
"A witty saying proves nothing." - Voltaire
mikewolf@tst-us.com
That's correct. You need to do two things
[ol][li]rename your form ... <form name="myForm">
[li]Change this line if (document.form.datab.options[cont].selected==true){ to
if (document.myForm.datab.selectedIndex == cont){
[/ol] Get the Best Answers! faq333-2924
"A witty saying proves nothing." - Voltaire
mikewolf@tst-us.com
Thanks for your help, but what I'm trying to accomplish here is to check how many databases the user using this form selected, and send the list of databases to my host each separate by a comma in the variable "db"...
I think what you showed me will only accomplish to verify that the index is equal to the variable cont...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.