Here are some things to look into. Once you understand how the pieces work, you'll just need to put them together.
element.value will give you the current value of a form input. For example:
document.getElementById('fromzone').value
<select id="fromzone" name="fromzone">..........</select>
<element onchange="Javascript Here;"> will execute Javascript when the value is changed.
So, I recommend adding an onchange event to each dropdown menu (you're not sure which they will set first, or you might be able to just do it on the second). Then get the value of both dropdowns (see .value above), using document.getElementById and this.value
Then once you have those two, you can put them in a function.
Code:
<script type="text/javascript">
function getcost(zone1,zone2) {
if (zone1==1&&zone2==2) { return 10; }
....
if (zone1==5&&zone2==6) { return 50; }
}
Of course there are many ways to setup a function like that. One way would be to use an array. But using lots of "ifs" will work and it's probably the easiest.
Bookmarks