<bdo id='6QBtr'></bdo><ul id='6QBtr'></ul>
<i id='6QBtr'><tr id='6QBtr'><dt id='6QBtr'><q id='6QBtr'><span id='6QBtr'><b id='6QBtr'><form id='6QBtr'><ins id='6QBtr'></ins><ul id='6QBtr'></ul><sub id='6QBtr'></sub></form><legend id='6QBtr'></legend><bdo id='6QBtr'><pre id='6QBtr'><center id='6QBtr'></center></pre></bdo></b><th id='6QBtr'></th></span></q></dt></tr></i><div id='6QBtr'><tfoot id='6QBtr'></tfoot><dl id='6QBtr'><fieldset id='6QBtr'></fieldset></dl></div>

<small id='6QBtr'></small><noframes id='6QBtr'>

<tfoot id='6QBtr'></tfoot>
<legend id='6QBtr'><style id='6QBtr'><dir id='6QBtr'><q id='6QBtr'></q></dir></style></legend>

        html表格如何通过更改悬停边框来突出显示列?

        How can a html table highlight columns by changing the border on hover?(html表格如何通过更改悬停边框来突出显示列?)

          1. <legend id='Q32J7'><style id='Q32J7'><dir id='Q32J7'><q id='Q32J7'></q></dir></style></legend>
            • <bdo id='Q32J7'></bdo><ul id='Q32J7'></ul>

              <tfoot id='Q32J7'></tfoot>
                <tbody id='Q32J7'></tbody>

                  <small id='Q32J7'></small><noframes id='Q32J7'>

                • <i id='Q32J7'><tr id='Q32J7'><dt id='Q32J7'><q id='Q32J7'><span id='Q32J7'><b id='Q32J7'><form id='Q32J7'><ins id='Q32J7'></ins><ul id='Q32J7'></ul><sub id='Q32J7'></sub></form><legend id='Q32J7'></legend><bdo id='Q32J7'><pre id='Q32J7'><center id='Q32J7'></center></pre></bdo></b><th id='Q32J7'></th></span></q></dt></tr></i><div id='Q32J7'><tfoot id='Q32J7'></tfoot><dl id='Q32J7'><fieldset id='Q32J7'></fieldset></dl></div>

                • 本文介绍了html表格如何通过更改悬停边框来突出显示列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在探索如何设置表格样式,以便在鼠标悬停在列上时可以更改边框.

                  I'm exploring how to style a table in such a way that the border can be changed when the mouse hovers over a column.

                  当鼠标悬停在一列上时,我想通过更改边框颜色来突出显示该列:

                  When the mouse is over a column, I want to highlight that column by changing the border color:

                  为了突出显示,我在 jQuery 库中使用了以下 JavaScript 代码:

                  To highlight, I am using the following JavaScript code with the jQuery library:

                  $('td').hover(function() {
                      var t = parseInt($(this).index()) + 1;
                      $('td:nth-child(' + t + ')').addClass('highlighted');
                  },
                  function() {
                      var t = parseInt($(this).index()) + 1;
                      $('td:nth-child(' + t + ')').removeClass('highlighted');
                  });
                  

                  使用以下 CSS:

                  .highlighted {
                      border-top: 2px solid black;
                      border-right: 2px solid black;
                      border-left: 2px solid black;
                  }
                  

                  您可以在此 JSFiddle 中查看其工作原理:http://jsfiddle.net/sCFjj/1/这仅在我将鼠标悬停在最左侧的列上时才有效.否则,它会突出显示右列(和顶部),但不会突出显示左垂直列.有没有办法让左竖列出现?

                  You can view how this works in this JSFiddle: http://jsfiddle.net/sCFjj/1/ This is only working when I hover on the left-most column. Otherwise it highlights the right-column (and top) but not the left vertical column. Is there a way of making the left-vertical column appear?

                  理想情况下,我希望效果忽略最低行,但我不确定如何从 jQuery 选择中排除一行.

                  Ideally, I would like the effect to ignore the lowest row, but I am not sure how to exclude a row from the jQuery selection.

                  我的尝试基于之前的问题.

                  推荐答案

                  链接:jsFiddle.还添加到上一列border-right,你会得到你想要的.我认为该列的右边界在下一个列的左边界之上.

                  Link: jsFiddle. Also add to previous collumn border-right and you will get that you want. I think that collumn's right border is over next collumn left border.

                  JavaScript:

                  JavaScript:

                  $('td').hover(function() {
                      var t = parseInt($(this).index()) + 1;
                      $('td:nth-child(' + t + ')').addClass('highlighted');
                  
                      if(t>1){
                          var t1 = t -1;
                          //alert("T:" + t + "<br/> T1:" + t1);
                          $('td:nth-child(' + t1 + ')').addClass('highlightedPrev');
                      }
                  },
                  function() {
                      var t = parseInt($(this).index()) + 1;
                      $('td:nth-child(' + t + ')').removeClass('highlighted ');
                          if(t>1){
                           var t1 = t -1;
                           $('td:nth-child(' + t1 + ')').removeClass('highlightedPrev');
                      }
                  });
                  

                  CSS:

                  .highlighted {
                      border: 2px solid black;
                  }
                  .highlightedPrev {
                      border-right: 2px solid black;
                  }
                  

                  希望我解决了你的问题.

                  Hope I solved your problem.

                  这篇关于html表格如何通过更改悬停边框来突出显示列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)

                    <bdo id='9Tvdq'></bdo><ul id='9Tvdq'></ul>
                  • <small id='9Tvdq'></small><noframes id='9Tvdq'>

                      <tbody id='9Tvdq'></tbody>

                      <legend id='9Tvdq'><style id='9Tvdq'><dir id='9Tvdq'><q id='9Tvdq'></q></dir></style></legend>

                          <i id='9Tvdq'><tr id='9Tvdq'><dt id='9Tvdq'><q id='9Tvdq'><span id='9Tvdq'><b id='9Tvdq'><form id='9Tvdq'><ins id='9Tvdq'></ins><ul id='9Tvdq'></ul><sub id='9Tvdq'></sub></form><legend id='9Tvdq'></legend><bdo id='9Tvdq'><pre id='9Tvdq'><center id='9Tvdq'></center></pre></bdo></b><th id='9Tvdq'></th></span></q></dt></tr></i><div id='9Tvdq'><tfoot id='9Tvdq'></tfoot><dl id='9Tvdq'><fieldset id='9Tvdq'></fieldset></dl></div>
                        • <tfoot id='9Tvdq'></tfoot>