在ThickBox開啟的iframe內設定物件focus的方法

最近專案剛好有個需求,要在彈跳視窗開啟後使用者可以藉由上下鍵或空白鍵去控制開啟後視窗的scrollbar藉以瀏覽頁面。

彈跳視窗是使用 ThickBox 來實作,但 ThickBox 開啟後focus是直接在 ThickBox 上,而不是 ThickBox 裡的iframe。

研究了一下 ThickBox 的source code,發現 ThickBox 會呼叫函式tb_showIframe()來載入iframe。

文章移至http://petekcchen.com/2010/05/set-focus-on-objects-inside-thickbox-iframe.html