I have a script that pulls a value from a drop down list, and writes an amount to a text box, depending on the option selected. I need to change it to take into account two values, from two different pull don menus, can I use else/if statements for this? For instance maybe something like this:
if (tbl == "0") and (reg="80")
{ttl.value="0"};
Complete script follows.
<script langauge="javascript">
<!-- Hide
function grandtotal()
{
var reg=document.form1.RegType.options[document.form1.RegType.selectedIndex].value;
var tbl=document.form1.DTables.options[document.form1.DTables.selectedIndex].value;
var ttl=document.form1.Total;
if (tbl == "null")
{ttl.value="0"};
else if (tbl == "0")
{ttl.value="80"};
else if (tbl == "100")
{ttl.value="180"};
else if (tbl == "180")
{ttl.value="260"};
}
// End Hiding -->
</script>
if (tbl == "0") and (reg="80")
{ttl.value="0"};
Complete script follows.
<script langauge="javascript">
<!-- Hide
function grandtotal()
{
var reg=document.form1.RegType.options[document.form1.RegType.selectedIndex].value;
var tbl=document.form1.DTables.options[document.form1.DTables.selectedIndex].value;
var ttl=document.form1.Total;
if (tbl == "null")
{ttl.value="0"};
else if (tbl == "0")
{ttl.value="80"};
else if (tbl == "100")
{ttl.value="180"};
else if (tbl == "180")
{ttl.value="260"};
}
// End Hiding -->
</script>