private void EtapaInicial_Click(object sender, EventArgs e)
{
EtapaInicialWasClicked = true;
}
private void panel_Click(object sender, EventArgs e)
{
if (EtapaInicialWasClicked)
{
panel1.BackgroundImage = Symbols.EtapaInicialbm;
EtapaInicialWasClicked = false;
}
}
为什么我的按键不能在Mac上工作?任何人都可以告诉我如何在Mac上进行按键删除工作?
答案 0 :(得分:0)
Backspace(8)和delete(46)在Mac上执行相同的操作。
更新的代码:
// keyboard down window check.
window.addEventListener("keydown", function(event) {
onKeyDownHandler(event);
}, false);
function onKeyDownHandler(e)
{
e.preventDefault();
var focus_id = e.target.id;
switch (e.keyCode) {
case 46: // Delete
case 8: // Backspace
alert("Delete pressed");
break;
}
}
答案 1 :(得分:0)
var input = document.getElementById('myInput');
input.onkeydown = function() {
var key = event.keyCode || event.charCode;
if( key == 8 || key == 46 )
return false;
};
=>根据相关的Jquery标记 -
jQuery(function($) {
var input = $('#myInput');
input.on('keydown', function() {
var key = event.keyCode || event.charCode;
if( key == 8 || key == 46 )
return false;
});
});