作者kiey (炼)
看板Ajax
标题[问题] 关於Table 里按按键的问题
时间Tue Nov 8 14:38:40 2011
我在写一个程式 想要在按下 左键 或 右键 触发
发现 firefox 没问题 但是 到了 ie 以後就不行了
不知道要怎麽改才比较好呢?
恳请各位高手赐教.....
function CreatTable(){
for( var i=0;i<sizeArray[1];i++) {
tr = bomBody.insertRow(bomBody.rows.length);
for( var j=0;j<sizeArray[0];j++) {
td = tr.insertCell(tr.cells.length);
td.id=('x'+j+'y'+i);
td.innerHTML = ' ';
if ( td.addEventListener )
td.addEventListener("mousedown", SetBom, false);
else
td.setAttribute("onmousedown", SetBom);
} } }
function SetBom(onevent) {
var onevent = onevent || window.event;
var onLeftButton=0 , onRightButton=2 ,
onMouseButton = onevent.button;
//alert(onMouseButton);
if ( onMouseButton == onLeftButton )
onLeft(this.id);
else if( onMouseButton == onRightButton)
onRight(this.id);
}
--
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 111.250.11.164
※ 编辑: kiey 来自: 111.250.11.164 (11/08 14:39)