2013-09-04 2 views
0

파이어 폭스 확장 기능을 쓰고 있는데이 xul에 포함 된 .js 파일에서 xul의 'oncommand'를 사용할 수 있는지 궁금합니다. 그것은 바보 같은 소리 수 있지만javascript는 xul의 oncommand를 사용할 수 없습니까?

내가이 상황 (XUL 파일)에서 사용할 수 있습니다 (:) 또는 가능한) 100 %는 불가능 확실하게 요구하기로 결정

<toolbarpalette id="BrowserToolbarPalette"> 
    <toolbarbutton id="quizy-toolbar-button" 
     class="toolbarbutton-1 chromeclass-toolbar-additional" 
     label="test" 
     tooltiptext="test button" 
     oncommand="engine.iconCommand()" 
    /> 
</toolbarpalette> 

을 그리고 내 포함에. js가 작동하지 않습니다.

document.oncommand = function(e){ 
    alert('tango down'); 
}; 
+0

왜 그걸 사용하고 싶은지에 대해 설명 할 수 있습니까? –

답변

3

는 아니,이 oncommand 특성 (bug 246720를 시청)이 없습니다.

하지만 결국 올바른 방법 인 command 이벤트를 수신 할 수 있습니다.

+2

즉 :'document.getElementById ("quizy-toolbar-button"). addEventListener ("command", function (e) {...}, false);'. 또한,'document.getElementById ("quizy-toolbar-button"). doCommand()'명령으로 실행할 수 있습니다. – nmaier