簡體   English   中英

使用javascript在ASP-classic網站中字體顏色不會改變

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

我有一張桌子,當我鼠標懸停在這個單元格上時,背景和字體顏色應該改變,然后在我mouseOut時改回來,但由於某種原因,我似乎無法讓字體改變顏色。 我正在使用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已經為此做了:hover

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM