Javascript函数验证更大没有不工作? [英] Javascript function to validate greater no is not working ?

查看:83
本文介绍了Javascript函数验证更大没有不工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是我的javascript功能检查验证获得的标记不应该大于最大标记不适用于大的不像1000



我尝试过:



我的Javascript功能

My problem is that my javascript funtion to check validation that obtained marks should not be greater than max marks is not working for large no like 1000

What I have tried:

My Javascript funtion

function Gmarks() {

                                var txtGMarksObtain =  parseInt(document.getElementById("<%=txtGMarksObtain.ClientID%>").value);
                                var txtGMaxMarks = parseInt(document.getElementById("<%=txtGMaxMarks.ClientID%>").value);

                                if (txtGMarksObtain > txtGMaxMarks) {
                                    alert("Graduation Obatined Marks must be less than Max Marks..");
                                    txtGMarksObtain.focus();
                                    return false;
                                }

                                return true;

                            }

 <asp:TextBox ID="txtGMarksObtain" onkeypress="return Gmarks()" runat="server" MaxLength="4"  />

推荐答案

我检查了你的代码,

你能不能如果条件是上面的警告检查:

I have checked your code,
can you check with alert above if condition :
"alert("txtGMarksObtain" + txtGMarksObtain + " and " + "txtGMaxMarks" + txtGMaxMarks);"





你得到的价值与否,我认为代码工作正常,但只是检查控制台你得到任何错误。



you got the value or not, i think code is working fine but just check in console you got the any error.


这篇关于Javascript函数验证更大没有不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆