Jump to content
Sign in to follow this  
jjqbunty

Help Please

Recommended Posts

Guys help me please, check if my code can work properly...

 

<script type="text/javascript" language="JavaScript">
function qtycheck() {
    if (qty_1.value > qtyact_1.value)
    {
        qty_1.value=00
        qtyactc_1.value = "Stock Alert"
        document.getElementById("qtyactc_1").style.backgroundColor = "#FF4533";
            
    return false;
    } else {

    qtyactc_1.value = ""
    }
    
} else {
    
    if (qty_2.value > qtyact_2.value){
        qty_2.value=00
        qtyactc_2.value = "Stock Alert"
        document.getElementById("qtyactc_2").style.backgroundColor = "#FF4533";
            
    return false;
    } else {

    qtyactc_2.value = ""
    
}

//-->
</script> 

Share this post


Link to post
Share on other sites

It looks like you're trying to use variables like qty_1 and qtyact_1 that aren't defined.

Share this post


Link to post
Share on other sites

Looks like very OLD code you are trying to implement.
Indications are:  <script type="text/javascript" language="JavaScript">

Show the pertinent HTML code associated with the problem.
Post #1 may reference the "field name/id", but you are not referencing them correctly.

 

Share this post


Link to post
Share on other sites

Don't assume that just because you put an ID on an element, that the browser will make a Javascript object for it.  Get the element with document.getElementById.

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...