0

我通过在键盘中输入回车键来验证文本框。验证工作正常,但没有显示 JAlert。但是当我在按钮上调用相同的功能时单击它会在 IE 中显示警报。我对此完全感到困惑。谁能帮我?演示

function isEnterPressed(event) {
        var keynum;
        if (window.event) {
            keynum = event.keyCode;
        }else if (event.which) {
            keynum = event.which;
        }
        if(keynum == 13) {
            searchSubmit();
        }
    }

searchSubmit() 也是按钮单击时的函数调用

function searchSubmit()
{
    // some valdation
  if(!flag) 
    {
    alert('flag'+flag);
    jAlert("Enter anyone of the value to search");
    return false;  
    }else{
    document.userManagementUsers.action=baseUrl;
    document.userManagementUsers.submit();
    }
 }

alert('flag'+flag) 通过点击回车键显示 jalert 未执行。

4

1 回答 1

0

你有没有尝试过这样的事情?

$('body').jAlert('Enter anyone of the value to search', 'success'); 

或者

$(document).ready(function() {
  $('body').jAlert('Enter anyone of the value to search', "success");
});
于 2013-01-21T09:30:11.310 回答