
改成

搜索为为空的时候在当前页面弹窗提示,不用易优默认的新窗口,新页面打开确实不友好

以下是js写法
// 为输入框添加绑定事件,文末有绑定事件使用说明
$("#keywords").bind('keypress', function (event) {
if(event.which == 13) { // 检测按键是否是回车键
if ($("#keywords").val() == '') {
alert("关键字不能为空");
window.location.href = "/";
return false;
}
document.getElementById("mysousuo").submit();
}
})
function topSearch(){
if($("#keywords").val() ==''){
alert("关键字不能为空");
window.location.href = "/";
return false;
}
document.getElementById("mysousuo").submit();
}具体方法名结合自己的样式修改。

相关文章
eyoucms模板网 