$("#dlgSearch").dialog({
autoOpen: false,
bgiframe: true,
width: 600,
//height: 225,
modal: true,
resizable: false,
open: function() {
//jquery之dialog的键盘事件(输入完毕回车检索)
$(this).bind("keypress.ui-dialog", function(event) {
if (event.keyCode == $.ui.keyCode.ENTER) {
alert("enter pressed!");
}
});
},
buttons: {
"取消": function() {
$(this).dialog("close");
},
"搜索": function() {
}
},
close: function() {
}
});
程序需要导入jquery和jquery ui的包,此程序在ie下显示正常,但是在火狐和谷歌里面没有显示。只是提示keydown的charcode不可用的错误,请高手帮忙啊
autoOpen: false,
bgiframe: true,
width: 600,
//height: 225,
modal: true,
resizable: false,
open: function() {
//jquery之dialog的键盘事件(输入完毕回车检索)
$(this).bind("keypress.ui-dialog", function(event) {
if (event.keyCode == $.ui.keyCode.ENTER) {
alert("enter pressed!");
}
});
},
buttons: {
"取消": function() {
$(this).dialog("close");
},
"搜索": function() {
}
},
close: function() {
}
});
程序需要导入jquery和jquery ui的包,此程序在ie下显示正常,但是在火狐和谷歌里面没有显示。只是提示keydown的charcode不可用的错误,请高手帮忙啊
$(this).bind("keypress.ui-dialog", function(event) {
var evt= event || window.event;
if (evt.keyCode == $.ui.keyCode.ENTER) {
alert("enter pressed!");
}
});
兼容参考:http://blog.csdn.net/IBM_hoojo/archive/2010/07/02/5708440.aspx
$(this).bind("keypress.ui-dialog", function(event) {
var evt= event || window.event;
if (evt.keyCode == 13) {//用13看看
alert("enter pressed!");
}
});