字体颜色获胜't在ASP经典网站中使用javascript进行更改

Font color won't change in ASP-classic site using javascript

本文关键字:javascript 网站 经典 获胜 颜色 ASP 字体      更新时间:2023-09-26

我有一个表,当我用鼠标悬停在这个单元格上时,背景和字体的颜色应该会改变,然后在我鼠标离开时又会变回来,但由于某种原因,我似乎无法让字体改变颜色。我正在使用asp classic和internet explorer 8。

<TH <%if boolHighlight=false then %>onMouseOver="this.bgColor='#E3E31B'; this.style.color='#ffffff';" onMouseOut="this.bgColor='#FFFFFF'; this.style.color='#000000';" <%end if%>style="width: 9%; cursor: hand; border-right: none; align: center; vertical-align: center;" 
    title="Click to get info">
    <font color="navy"><%= RS("ROLL_ID")%></font>
</TH>

在ASP文件中

<% 
  thClass = IIf(boolHighlight, "hl", "")
%>
<!-- later... -->
<th class="info <%=thClass%>" title="Click to get info"><%=RS("ROLL_ID")%></th>

在您的CSS文件中

th.info {
  color: navy;
  background-color: white;
}
th.info.hl:hover {
  color: #ffffff;
  background-color: #E3E31B;
}

票据

  • 不要使用字体标记。永远
  • 不要使用内联样式,而是使用CSS类和单独的CSS文件
  • 不要在JavaScript中进行滚动效果。CSS :hover就是为此而制作的