[Javascript] value of select

Michael Borchers borchers at tridem.de
Mon Apr 25 05:34:58 CDT 2005


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>



More information about the Javascript mailing list