<div class="htmlarea"> <textarea id="runcode85297"> <title> 取得鼠标所在位置的对象 </title> <meta name="Author" content="宝玉 [url]http://www.nwpubbs.net[/url]"> <script language="javascript"> <!-- function fnGetTable( oEl ) { try{ while( null != oEl && oEl.tagName!="TABLE" ) { oEl = oEl.parentElement; } return oEl; } catch(e) { return null; } } function pos() { try{ oElement = document.elementFromPoint(event.x,event.y); oElement = fnGetTable(oElement); if(oElement.tagName=="TABLE") show.innerText=oElement.id; } catch(e) {} } // --> </script> <table border="1" cellpadding="" cellspacing="" width="" id="table1"> <tr> <td>table1</td> </tr> </table> <table border="1" cellpadding="" cellspacing="" width="" id="table2"> <tr> <td>table2</td> </tr> </table> <table border="1" cellpadding="" cellspacing="" width="" id="table3"> <tr> <td>table3</td> </tr> </table> <table border="1" cellpadding="" cellspacing="" width="" id="table4"> <tr> <td>table4</td> </tr> </table> <table border="1" cellpadding="" cellspacing="" width="" id="table5"> <tr> <td>table5</td> </tr> </table> <table border="1" cellpadding="" cellspacing="" width="" id="table6"> <tr> <td>table6</td> </tr> </table> 鼠标当前在:<span id="show"></span> </textarea><br><input onclick="runEx('runcode85297')" type="button" value="运行代码"> <input onclick="doCopy('runcode85297')" type="button" value="复制代码"> <input onclick="doSave(runcode85297)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div> <br>