JS小技巧

 

 function fy() {
        var pageNo = document.getElementById("pageNo").value;
        if ( 1 <= pageNo && pageNo <= ${PAGE_SESSION.allPageNo}) {
            window.location.href="/crm/crmservlet?method=findAllCustomer&pageNo="+pageNo;
        } else {
            alert("请输入正确的页码!");
            var pageNoElement = document.getElementById("pageNo");
            pageNoElement.focus();
            pageNoElement.select();
        }

 

 

将光标定位到inputID处(focus()),并选中原内容(select())

 

posted on 2014-10-23 21:04  SkyGood  阅读(163)  评论(0编辑  收藏  举报