View Full Version : Change Value from Select Menu Based on the value of a javascript variable

03-30-2006, 10:55 PM

I am creating a quoting program for our organisation and need the program to select/change the value which is selected by default in the drop down menu, based on whether another variable on the page is Yes or No.

Is anybody able to help me? This is rather urgent.

Thanks heaps,

03-31-2006, 04:37 AM
There are many ways to access a form element and also many ways to determine the value of a variable and then branch your code depending upon what that value is. I'm assuming that you know which one's that you would like to use. Here is one way of changing the selected option of a drop down:

<select id="sel">
<script type="text/javascript">