CSS樣式設定(滑鼠經過表格變色和控製表格隔行變色和添加CSS檔案引用)

來源:互聯網
上載者:User

滑鼠經過表格變色樣式:
 <style>  
  table   {   background-color:#000000;   cursor:hand;   width:100%;   }  
  td   {  
  /*設定onmouseover事件*/  
  onmouseover:   expression(onmouseover=function   (){this.style.borderColor   ='blue';this.style.color='red';this.style.backgroundColor   ='yellow'});  
  /*設定onmouseout事件*/  
  onmouseout:   expression(onmouseout=function   (){this.style.borderColor='';this.style.color='';this.style.backgroundColor   =''});  
  background-color:#ffffff;  
  }  
  </style>
控製表格隔行變色:
    簡單應用:
        <style type="text/css">
<!--
tr {background-color:expression((this.sectionRowIndex%2==0)?"#E1F1F1":"#F0F0F0")}
-->
    進階應用程式:每個儲存格變色
        <style type="text/css">
<!--
tr {background-color:expression((this.sectionRowIndex%2==0)?"red":"blue")}
td {background-color:expression((this.cellIndex%2==0)?"":((this.parentElement.sectionRowIndex%2==0)?"green":"yellow"))}
-->
</style>
添加CSS檔案引用:
<link id="cssStyle" rel="stylesheet" type="text/css" href="../style.css" />

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.