jjqbunty Posted June 28, 2019 Share Posted June 28, 2019 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> Link to comment Share on other sites More sharing options...
justsomeguy Posted June 28, 2019 Share Posted June 28, 2019 It looks like you're trying to use variables like qty_1 and qtyact_1 that aren't defined. Link to comment Share on other sites More sharing options...
jjqbunty Posted June 29, 2019 Author Share Posted June 29, 2019 no, its field name/id of my form.. Sorry for bad knowledge in programming....:( Link to comment Share on other sites More sharing options...
JMRKER Posted June 30, 2019 Share Posted June 30, 2019 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. Link to comment Share on other sites More sharing options...
justsomeguy Posted July 1, 2019 Share Posted July 1, 2019 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now