我有一个使用EXT.NET框架进行控制的项目。我目前正在研究关闭面板标签的行为,例如Google Chrome和所有现代浏览器。
我找不到答案。鼠标滚轮按钮的ASCII值是多少?如何在C#ASP.NET中处理此事件?
答案 0 :(得分:0)
使用Firefox,Explorer和Chrome:
$(document).ready(function() {
$(document).mousedown(function(e) {
closeTab(e);
});
});
function closeTab(e) {
if (!e) {
e = window.event;
e.which = e.keyCode;
}
if(e.which == 2){
var tbpPrincipal = <%= tbpPrincipal.ClientID %>;
var activeTab = null;
for (var i = 0; i < tbpPrincipal.items.length; i++) {
var currentTab = tbpPrincipal.items.items[i];
if (e.target.innerText == currentTab.title || e.target.textContent == currentTab.title) {
activeTab = currentTab;
break;
}
}
if (activeTab) {
var activeTabIndex = tbpPrincipal.items.findIndex('id', activeTab.id);
tbpPrincipal.remove(activeTabIndex);
}
}
return true;// to allow the browser to know that we handled it.
}