Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] value of select
- From: flavio at economisa.com.br (Flavio Gomes)
- Subject: [Javascript] value of select
- Date: Mon Apr 25 08:47:18 2005
I don't know why it doesn't worked or if should it work, but you can try
removing the 'options' statement
var myComboBox = document.orders.orders_status_id; //this is just for
simplifying
var orders_status_id = myComboBox[myComboBox.selectedIndex].value;
// myComboBox.options[0] is the same as myComboBox[0]
Second: have you realised that in the "OPTION" that says '1' it's value
is empty and in the "OPTION" that says '2' it's value is '1', right?
Hope to Help,
--
Flavio Gomes
flavio@xxxxxxxxxxxxxxxx
Michael Borchers wrote:
>Well, you didn't have the opening <script> tag or a submit button. But
>it worked once I added those.
>
><form action="..." method="post" name="orders" onSubmit="return
>orders_submit()">
><select name="orders_status_id">
> <option value="">1</option>
> <option value="1">2</option>
></select>
>
><input type="submit" id="btnSubmit" name="btnSubmit" value="Submit Form" />
></form>
>
>
><script type="text/javascript">
>function orders_submit()
>{
> var orders_status_id =
>document.orders.orders_status_id.options[document.orders.orders_status_id.selectedIndex].value;
>
> if (orders_status_id == "1")
> {
> alert('test');
> }
>}
></script>
>
><
>
>sorry, my mistake when i copied the code,
>of course i had the missing tags in my original script too:)
>but still it won't work:(
>
>it says:
>document.orders.orders_status_id.options is empty:(
>_______________________________________________
>Javascript mailing list
>Javascript@xxxxxxxxxx
>https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
- References:
- AW: [Javascript] value of select
- From: Michael Borchers
- AW: [Javascript] value of select
- Prev by Date: [Javascript] value of select
- Next by Date: [Javascript] Two JS interfering with each other?
- Previous by thread: [Javascript] value of select
- Next by thread: AW: [Javascript] value of select
- Index(es):