javascript 与jquery方法怎么区别,在jquery中想用js方法可以吗?

解决方案 »

  1.   

    怎么没有人回答?
    怎么检查一个文本的value 是否是int?
      

  2.   

    <html>
    <head><title>test</title>
    <script type="text/javascript">
    var txt1Val = document.getElementById("txt1").value;
    //方法1:
    if(/^\d+$/.test(txt1Val))
    {
        alert("true");
    }
    //方法2:
    if(parseInt(txt1Val) == txt1Val)
    {
        alert("true");
    }
    </script>
    </head>
    <body>
    <input type="text" id="txt1" />
    </body>
      

  3.   

    用Jquery的话可以把第一个语句改成
    var txt1Val = $("#txt1").val();