Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] value of select
- From: shawn.milo at gmail.com (Shawn Milo)
- Subject: [Javascript] value of select
- Date: Mon Apr 25 07:32:04 2005
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>
Shawn
On 4/25/05, Michael Borchers <borchers@xxxxxxxxx> wrote:
> why won't this work?
> can't see the alert:(
>
> must the script function be posted in front of the form?
>
> i guess thatvar orders_status_id is defined wrong:/
>
> <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>
> </form>
>
> 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>
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
--
Voicemail any time at:
206-666-MILO
- References:
- [Javascript] value of select
- From: Michael Borchers
- [Javascript] value of select
- Prev by Date: [Javascript] value of select
- Next by Date: AW: [Javascript] value of select
- Previous by thread: [Javascript] value of select
- Next by thread: AW: [Javascript] value of select
- Index(es):