b/s or c/s?B/S:
<script>
       var rowId;
</script>
<tr onmouseover="this.rowId=1;">.....

解决方案 »

  1.   

    b/s的用onclick 表示选择的行不用onmouseover
      

  2.   

    补充移走事件:
    <script>
           var rowId;
    </script>
    <tr onmouseover="this.rowId=1;" onmouseout="this.rowId=-1;">.....onmouseover改成onclick也是可以的,不过我喜欢onmouseover.
      

  3.   

    如果鼠标 找个空白的地方一点
    这个时候rowId 还是原来的值,需求是 rowId变为空
      

  4.   

    <script>
           var rowId;
    </script>
    <body onclick="this.rowId=-1;">
    <tr onmouseover="this.rowId=1;">.....
      

  5.   

    这样一搞
    连 tr上的onchick也 激发了 body的onclick造成了最终 点击 行的时候 结果就是-1了
      

  6.   

    tr上是onmouseover,不是onclick如果你要都做onclick要先判断事件源是什么.if(event.srcElement.tagName == 'TR')
        retrun;
    else if(event.srcElement.tagName == 'BODY')
        this.rowId=-1;
      

  7.   

    这个解决方案感觉不好
    如果在body外面点击 还是不行呀
      

  8.   

    以前做个菜单,在它的回收事件,我们考虑了很多.body外面,iframe外面,对话框外面......虽然要写很多,但也根本没办法.b/s开发就是这么复杂.