CSS代码

  /*********************/
/*      Tooltip      */
/*********************/

a.tooltip, a.tooltip:link, a.tooltip:visited, a.tooltip:active  {
  position: relative;
  text-decoration: none;
  cursor: pointer;
  font-style: italic;
  }

a.tooltip:hover {
  font-weight: bold;
  background: transparent;
  visibility:visible;
  }

a.tooltip span {
  display: none;
  text-decoration: none;
}

a.tooltip:hover span {
  display: block;
  position: absolute;
  top: 20px;
  left: 0;
  z-index: 2000;
  color: #000000;
  border:1px solid #000000;
  background: #efefef;
  font-family : Verdana, Arial,Helvetica,sans-serif;
  font-size:    11px;
  text-align: left;
  }

a.tooltip span b {
  display: block;
  margin: 0;
  padding: 2 2 2 2;
  font-family : Verdana, Arial,Helvetica,sans-serif;
  font-size: 12px;
  font-weight: bold;
  font-style: normal;
  color: #FFFFFF;
  background-color: #000000;
  border-bottom: 1px solid black;
}

.analyzerGuiStatistics .queriesPerDayTable{
    border-spacing: 0px;   /* -> This property will not be interpreted correctly even up to IE 7; normally substitute for cellspacing="0"; */
    border-collapse: collapse;  /* this will work in ie and moz */
    width: 150px;
}


JSP代码

<a class="tooltip"><%=results.getRecordCount()%>
<span>
  <b><bean:message bundle="AnalyzerTexts" key="queries.perDay"/></b>
   <table class="tooltip queriesPerDayTable">
    <%for (inta=0a<searchesAtDay.size();a++)   {                                                     if(a%2==0) {bgColor=brightBgColor;}
      else {bgColor=darkBgColor;}%>
     <tr class="<%=bgColor%>">
                                           <td><%=displayDateFormatMedium.format(logDays.get(a))%></td>
    <td class="config_el_align_right"><%=searchesAtDay.get(a)%></td>
   </tr>
   <%} %>
  </table>
   </span>
   </a>


上面的工具提示在Firefox中效果很好,但在IE中效果不佳?

最佳答案

IE不支持没有:hover属性的锚标记上的href

您需要将属性添加到代码中,以使其在IE中起作用,例如:

<a class="tooltip" href="#">

关于javascript - Internet Explorer中的工具提示问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5960930/

10-10 11:24