PDA

View Full Version : Is there anyway?


o0_Enigma_0o
08-14-2002, 08:35 AM
<input type="text" name="qty1" onBlur="total1.value=this.value*8.50" size="5" value="0">

I one question

is there anyway of making it use *8.50 if the value of qty1 is less then 5?
and if its 5 + it will use *7.65

Thanks inadvance :thumbsup:

duniyadnd
08-14-2002, 09:59 AM
Within your head tags:

<script language="JavaScript">
<!--

function whatever(num)
{

var temp = window.document.formName.qty1.value;
var num = temp - 0;

if (num < 5)
{
return total1.value = num * 8.50;
}
else
{
return total1.value = num * 7.65;
}
}

-->
</script>



<input type="text" name="qty1" onBlur="whatever();" size="5" value="0">

Should work, if not, let me know.

Later
Umang

glenngv
08-14-2002, 10:04 AM
<input type="text" name="qty1" onBlur="val=this.value;if (!isNaN(val)){if(val<5) factor=8.5;else factor=7.65;this.form.total1.value=val*factor;}" size="5" value="0">

o0_Enigma_0o
08-14-2002, 10:05 AM
var temp = window.document.formName.qty1.value;

its showing this up as a error within the browser

is there a way round it?

Says its null or not an object

duniyadnd
08-14-2002, 10:07 AM
change formName with the name of your form.

Duniyadnd

o0_Enigma_0o
08-14-2002, 10:16 AM
yay that works
thx guys