As you can see in the picture that if i click the selected tab "Navigation" then only the rename option is appearing (pic 2). I want to make this via key board.
如圖所示,如果單擊所選選項卡“導航”,則只顯示重命名選項(圖2)。我想通過鍵盤制作這個。
JavaScript code:
JavaScript代碼:
_makeEditable: function() {
var instance = this;
if (instance._isModifiable) {
var currentItem = instance._navBlock.find('li.selected');
var currentLink = currentItem.find('a');
var currentSpan = currentLink.find('span');
currentLink.click(
function(event) {
if (event.shiftKey) {
return false;
}
}
);
0
You might want to try something like this:
您可能想嘗試這樣的事情:
prototype.js:
的prototype.js:
document.observe('keydown', mainWindowKeyDown);
jquery (not sure about this, I don't use jquery often):
jquery(不確定這個,我不經常使用jquery):
$(function()
{
$(document).keydown(mainWindowKeyDown);
});
The keydown handler could be something like:
keydown處理程序可能是這樣的:
/*
Called when hitting any key.
*/
function mainWindowKeyDown(e)
{
if (e.keyCode == 113) // when F2 is pressed
triggerTabRename();
//else if (e.ctrlKey && e.keyCode == 90) // when ctrl + 'z' pressed
// doSomethingWhenCtrlZWasPressed(e);
//else if (e.ctrlKey && e.keyCode == 88) // when ctrl + 'x' pressed
// doSomethingWhenCtrlXWasPressed(e);
}
Here you can find a list of keycodes.
在這里您可以找到密鑰代碼列表。
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2011/05/27/7253730818be317f4a1598e603b83bd2.html。