css裡可以加運算式 :expression

來源:互聯網
上載者:User

比較強的css

HTML代碼:<html><br /><head><br /><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><br /><title>表格CSS測試</title><br /><style type="text/css"><br /><!--<br />#DataGrid1 tr {<br />background-color: expression(<br />this.sectionRowIndex == 0 ? "#FFCCCC" :<br />(<br />(this.sectionRowIndex % 2 == 0) ? "#FFF0F0" : "#F0F0FF"<br />)<br />);<br />color: expression(this.sectionRowIndex == 0 ? "#FFFFFF" : "");<br />font-weight: expression(this.sectionRowIndex == 0 ? "BOLD" : "");<br />TableSelect: expression(<br />this.sectionRowIndex == 0 ? "" :<br />(<br />onmouseover = function()<br />{<br />this.style.backgroundColor =<br />(<br />this.style.backgroundColor != "#69cdff" ? "#69cdff" :<br />(<br />this.sectionRowIndex == 0 ? "#FFCCCC" :<br />(<br />this.sectionRowIndex % 2 == 0 ? "#FFF0F0" : "#F0F0FF"<br />)<br />)<br />)<br />},<br />onmouseout = function()<br />{<br />this.style.backgroundColor =<br />(<br />this.style.backgroundColor != "#69cdff" ? "#69cdff" :<br />(<br />this.sectionRowIndex == 0 ? "#FFCCCC" :<br />(<br />this.sectionRowIndex % 2 == 0 ? "#FFF0F0" : "#F0F0FF"<br />)<br />)<br />)<br />}<br />)<br />)<br />}<br />#DataGrid1 td {<br />background-color:expression(<br />this.cellIndex == 0 ?<br />(<br />this.parentElement.sectionRowIndex == 0 ? "#FFCCCC" : "#DDDDDD"<br />)<br />: null<br />)<br />}<br />.FindAreaTable {<br />font-size: 12px;<br />color: #333333;<br />text-decoration: none;<br />width: 1024px;<br />cursor: hand;<br />background-color: #FFFFFF;<br />vertical-align: middle;<br />text-align: center;<br />}<br />--><br /></style><br /></head><br /><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0"><br /><table cellspacing="1" class="FindAreaTable" ID="DataGrid1"><br /><tr><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /></tr><br /><tr><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /></tr><br /><tr><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /></tr><br /><tr><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /></tr><br /><tr><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /></tr><br /><tr><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /></tr><br /><tr><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /></tr><br /><tr><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /></tr><br /><tr><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /></tr><br /><tr><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /></tr><br /><tr><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /></tr><br /><tr><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /></tr><br /><tr><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /></tr><br /><tr><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /></tr><br /><tr><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /><td>表格測試</td><br /></tr><br /></table><br /></body><br /></html><br />
[Ctrl+A 全部選擇 提示:你可先修改部分代碼,再按運行]

css裡可以加運算式   :expression

<style>
 <!--
  .td  { font-size: 9pt; weaver:expression(highlight(this))}
 -->
</style>
 
<SCRIPT LANGUAGE="JavaScript">
 <!--
  function highlight(obj){
 var hightlightBgColor = '#d6d6d6';
  obj.onmouseover = function(){
  var o = event.srcElement;

  if(o.tagName=="TD"){
   with(o.parentElement){
    style.backgroundColor = hightlightBgColor;
   }
  }
 }
 
 obj.onmouseout = function(){
  var o = event.srcElement;
  if(o.tagName=="TD"){o.parentElement.style.backgroundColor = '';}
 }
}
 function ControlContent01(){
    if (contentid01.style.display == 'none'){
     contentid01.style.display = '';
  imgarrow01.src = 'gray_up_arrow.gif';
 }
    else {
     contentid01.style.display = 'none';
  imgarrow01.src = 'gray_down_arrow.gif';
 } 

}

  //-->
</SCRIPT>

==================================================================================

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> CSS樣式裡使用JavaScript(onmouseover/onmouseout)2</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">

<style type="text/css">
table
{

 background-color:#000000;
 cursor:hand;
}

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>
</HEAD>

<BODY>
<TABLE cellspacing='1px' border='1'>
<TR >
 <TD >風兒吹散了蒲公英......    </TD>
 <TD>風兒吹散了蒲公英......   </TD>
 <TD>風兒吹散了蒲公英......   </TD>
</TR>
<TR >
 <TD >風兒吹散了蒲公英......    </TD>
 <TD>風兒吹散了蒲公英......   </TD>
 <TD>風兒吹散了蒲公英......   </TD>
</TR>
</TABLE>
</BODY>
</HTML>

相關文章

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.