将“回车(ENTER)”转成“切换(TAB)”的JS和jQuery写法
普通js
view plaincopy to clipboardprint?<mce:script type="text/javascript"><!--
document.body.onkeydown = function()
{
if(event.keyCode == 13)
{
event.keyCode = '9'
}
}
// --></mce:script>
<mce:script type="text/javascript"><!--
document.body.onkeydown = function()
{
if(event.keyCode == 13)
{
event.keyCode = '9'
}
}
// --></mce:script>
jQuery
view plaincopy to clipboardprint?$(document).ready(function(){
$(document).keydown(function(){if(event.keyCode==13){event.keyCode='9';}})
});