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
Share on other sites

ok i added it to the <form> but i am still not getting an alert.. should i get it when i click the button?

 

<form name="paypalForm" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" onsubmit="validateIt()">

Link to comment
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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.