Jump to content

this is not working, see anything wrong?


zang8027

Recommended Posts

my onsubmit is not firing

 

<form name="paypalForm" action="paypal.com" method="post">
<input type="text" name="quantity" value="type your quantity" onsubmit="validateIt()" onfocus="clearVal" />

 

<script>
function validateIt()
{
var quan= document.paypalForm.quantity.value;
if(quan>=0)
{
if(quan<=1000)
{
	alert("The price is 19 cents");
}
} else if(quan>=1001)
{
if(quan<=5000)
{
	alert("The price is 18 cents");
}
} else if(quan>=5001)
{
if(quan<=10000)
{
	alert("The price is 17 cents");
}
}
}
</script>

Link to comment
https://forums.phpfreaks.com/topic/158143-this-is-not-working-see-anything-wrong/
Share on other sites

This works for me

<script>
function validateIt()
{
var quan= document.paypalForm.quantity.value;
if(quan>=0)
{
   if(quan<=1000)
   {
      alert("The price is 19 cents");
   }
} else if(quan>=1001)
{
   if(quan<=5000)
   {
      alert("The price is 18 cents");
   }
} else if(quan>=5001)
{
   if(quan<=10000)
   {
      alert("The price is 17 cents");
   }
}
}
</script>
<form name="paypalForm" action="paypal.com" method="post" onsubmit="validateIt();">
<input type="text" name="quantity" value="type your quantity" />
</form>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.