Forums

This topic is locked

calculating text fields

Posted 29 Sep 2003 19:20:28
1
has voted
29 Sep 2003 19:20:28 Rian Carstens posted:
Hi

I have 2 text fields in a form, 1. minPounds; 2. minEuros. I have a dynamic exchange rate of 1.41, which is coming from the database. What I want to happen is that when the user types in the Pounds value in minPounds the minEuros value should automatically be calculated (multiplied by the current exchange rate) but I cannot work out the javascript for this.

This is the javascript I have so far:

<script language="JavaScript" type="text/JavaScript">
<!--

function CheckExRateMin () {
minPounds = document.form1.minPounds.value
ExRate = 1.41
minEuros = minPounds * ExRate

}
function CheckExRateMax () {
maxPounds = document.form1.maxPounds.value
ExRate = 1.41
maxEuros = maxPounds * ExRate

}
//-->
</script>
<script language="VBScript">
function CheckExRateMin()
call CheckExRateMin()
minEuros = formatnumber(minEuros,2)
document.form1.minEuros.value = (minEuros)
end function

function CheckExRateMax()
call CheckExRateMax()
maxEuros = formatnumber(maxEuros,2)
document.form1.maxEuros.value = (maxEuros)
end function
</script>


Please can you help me or point me in the right direction?

Thanks

Rian

Reply to this topic