Jump to content

Getting errors whith numbers


monkeybidz

Recommended Posts

When I enter a value of less than 1.00 I get an alert. I want to be able to enter a numeric value of 0.01 and above. Here is the script:

 

 

<script type ="text/javascript">

function chkbidprice()

{

 

//alert(parseInt(document.getElementById('buy').value));

 

if(parseInt(document.bid.bid.value) >0){}

else

{

alert("Your maximum bid is invalid. Please bid again!");

return false;

}

if(parseInt(document.bid.bid.value) < parseInt(document.getElementById('start').value))

{

alert("Your maximum bid should be greater or equal to start bid! Please try again!");

return false;

}

if((parseInt(document.getElementById('buy').value)>0) && parseInt(document.bid.bid.value) > parseInt(document.getElementById('buy').value))

{

alert("Your maximum bid can not be greater than Buy it now ! Please try again!");

return false;

}

}

 

  </script>

 

Link to comment
Share on other sites

 

try this and see how it works out for you:

 


<script type="text/javascript">
                  function chkbidprice()
                  {
                     var currentBidVal = document.bid.bid.value;
                     var bidval = parseInt(currentBidVal);
                     var intial = document.getElementById('start').value;
                     var beginbid = parseInt(intial);
                     var buyItNow = document.getElementById('buy').value;
                     var buy = parseInt(buyItNow);

                     if (bidval > 0)
                     {
                     // do nothing
                     }
                     else if (bidval == "0")
                     {
                        alert("Your maximum bid is invalid. Please bid again!");
                     }
                     else if (bidval < beginbid)
                     {
                        alert("Your maximum bid should be greater or equal to start bid! Please try again!");
                     }
                     else if (buy > "0" && bidval > buy)
                     {
                        alert("Your maximum bid can not be greater than Buy it now ! Please try again!");
                     }
                  }
                  
                 </script>

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.