Re: Re: Bug #4148 Updated: Inserting multiple values from the control Option into a field in the table

From: Date: Mon, 17 Apr 2000 08:03:35 +0000
Subject: Re: Re: Bug #4148 Updated: Inserting multiple values from the control Option into a field in the table
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-17961@lists.php.net to get a copy of this message
Hi, : function fun1() : { : variable = document.forms[0].elements['busstype[]']; : alert(variable) : } If that *doesn't* work, you might want to use the element index (you'll have to change it if you insert more form fields before that field) Try: function fun1() { var myobj = document.forms[0].elements[0]; for ( var i = 0 ; i < myobj.options.length ; i++ ) { if ( myobj.options[i].selected ) alert ( myobj.options[i].text ); } // single value: // alert ( myobj.value ); } <cut> Enjoy! Faisal Nasim Pakistan.

« previous php.dev (#17961) next »