作者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)