HTML code: Copy code The code is as follows: Please enter the price: < input type="text" id="txtProPrice" /> JS code: Copy code The code is as follows: <br>< /script><br><script type="text/javascript" language="javascript"><br> function ckProPrice() {<br> //Determine the product price<br> var reg = /(^[- ]?[1-9]d*(.d{1,2})?$)|(^[- ]?[0]{1}(.d{1,2})?$)/;<br> if ($("#txtProPrice").val() == "") {<br> alert("The product price cannot be empty!");<br> return false;<br> } else {<br> if (!reg.test($("#txtProPrice").val())) {<br> alert("The market price must be a legal number (positive number, up to two decimal places)!");<br> false;<br> ; }<br> $(function() { <br> ;</div>