Further to this - the thickbox is an iframe and when the iframe has focus (e.g. if you highlight some text) the esc button does not work. If you then click on the header (where the esc text is) then click escape it works. So I have added the following code to my $ (document).ready(function(){}); :
$(this).keydown(function(e){ if (e == null) { // ie keycode = event.keyCode; } else { // mozilla keycode = e.which; } if(keycode == 27){ // close top.tb_remove(); } }); which is almost the same as the code in the thickbox. This solves the problem, at least on FF3 on OS X!! Hope this may prove useful for someone else. Cheers, Dave On Jul 15, 1:13 pm, phipps_73 <[EMAIL PROTECTED]> wrote: > Hi, > > I have a thickbox which is working perfectly apart from when you press > the escape key on win xp running FF3. > > Nothing happens. I looked at the code and saw this (keycode 27 is > escape on IE): > > document.onkeydown = function(e){ > if (e == null) { // ie > keycode = event.keyCode; > } else { // mozilla > keycode = e.which; > } > if(keycode == 27){ // close > tb_remove(); > } else if(keycode == 190){ // display previous image > if(!(TB_NextHTML == "")){ > document.onkeydown = ""; > goNext(); > } > } else if(keycode == 188){ // display next image > if(!(TB_PrevHTML == "")){ > document.onkeydown = ""; > goPrev(); > } > } > > }; > > I think the problem may be on this line: > > keycode = e.which; > > Should this be: > > keycode = e.DOM_VK_ESCAPE; > > Has anyone else seen this problem, have a fix? > > Cheers, > > Dave