zoukankan      html  css  js  c++  java
  • js ondocumentready onmouseover onclick onmouseout 样式

    <PUBLIC:ATTACH EVENT="ondocumentready" ONEVENT="doInit()" />
    <PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="doMouseover()" />
    <PUBLIC:ATTACH EVENT="onclick" ONEVENT="doClick()" />
    <PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="doMouseout()" />

    <PUBLIC:PROPERTY name="test" />


    <SCRIPT LANGUAGE="JavaScript">
    var lastObj = null;
    var lastColor = null;
    function doInit(){
     if(element==null){
      return;
     }
     var objT = element.children[0];
     try{
      objT.rows(0).className="grid_title";
      objT.rows(1).className="grid_title";
     }
     catch(err){
      objT.className="grid_title";
     }
     
     objT = element.children[1];
     if(objT.rows(0)==null){
      return;
     }
     objT.rows(0).className="gridding1";
     for(i=1;i<objT.rows.length;i++){
      if(i%2==1){
      
       objT.rows(i).className="gridding1";
      }
      else{
       objT.rows(i).className="gridding1";
      }
     }
    }
    function doClick(){
     if(event.srcElement.tagName=="TD"){
      var curObj = event.srcElement.parentElement;
      if(curObj.rowIndex==0) return false;
      try{
       if(curObj.children[0].children.length == 0 ) return false;
      }
      catch(err){
       return false;
      }
      if(curObj.children[0].children[0].checked){
       curObj.children[0].children[0].checked = false;
      }
      else{
       lastObj = curObj;
       lastColor = "#FFFFFF";
       curObj.children[0].children[0].checked = true;
      }
     }
     if(event.srcElement.tagName =="INPUT"){
      try{
       var curObj = event.srcElement.parentElement.parentElement;
       if(curObj.rowIndex==0) {
        var obj = curObj.parentElement.parentElement;
        for(i=1;i<obj.rows.length;i++){
         if(obj.rows(0).children[0].children[0].checked){
          obj.rows(i).children[0].children[0].checked = true;
          obj.rows(i).style.backgroundColor="#FFFFFF";
          obj.rows(i).style.color="#000000";
         }
         else{
          obj.rows(i).children[0].children[0].checked = false;
          if(i%2==1){
           obj.rows(i).style.backgroundColor="#FFFFFF";
           obj.rows(i).style.color="#000000";
          }
          else{
           obj.rows(i).style.backgroundColor="#FFFFFF";
           obj.rows(i).style.color="#000000";
          }
         }
        }
       }
      }
      catch(err){
       return true;
      }
     }
    }
    function doMouseover(){
     if( event.srcElement.tagName=="TD"){
      var curObj = event.srcElement.parentElement;
      if(curObj.rowIndex==0) return false;
      curObj.style.backgroundColor="#F2FFEE";
     }
     if( event.srcElement.tagName=="INPUT"){
      var curObj = event.srcElement.parentElement.parentElement;
      if(curObj.rowIndex==0) return false;
      curObj.style.backgroundColor="#F2FFEE";
     }
    }

    function doMouseout(){
     if(event.srcElement.tagName=="TD"){
      var curObj = event.srcElement.parentElement;
      if(curObj.rowIndex==0) return false; 
      try{
       if(curObj.children[0].children.length == 0 ) {
        if(curObj.rowIndex%2==1){
         curObj.style.backgroundColor="#FFFFFF";
         curObj.style.color="#000000";
        }
        else{
         curObj.style.backgroundColor="#FFFFFF";
         curObj.style.color="#000000";
        }
        return true;
       }
      }
      catch(err){
       if(curObj.rowIndex%2==1){
        curObj.style.backgroundColor="#FFFFFF";
        curObj.style.color="#000000";
       }
       else{
        curObj.style.backgroundColor="#FFFFFF";
        curObj.style.color="#000000";
       }
       return true;
      }
      if(curObj.rowIndex%2==1)
       if(curObj.children[0].children[0].checked){
        curObj.style.backgroundColor="#FFFFFF";
        curObj.style.color="#000000";
       }
       else{
        curObj.style.backgroundColor="#FFFFFF";
        curObj.style.color="#000000";
       }
      else
       if(curObj.children[0].children[0].checked){
        curObj.style.backgroundColor="#FFFFFF";
        curObj.style.color="#000000";
       }
       else{
        curObj.style.backgroundColor="#FFFFFF";
        curObj.style.color="#000000";
       }
     } 
     
     if(event.srcElement.tagName=="INPUT"){
      var curObj = event.srcElement.parentElement.parentElement;
      if(curObj.rowIndex==0) return false; 
      try{
       if(curObj.rowIndex%2==1){
        if(curObj.children[0].children[0].checked){
         curObj.style.backgroundColor="#FFFFFF";
         curObj.style.color="#000000";
        }
        else{
         curObj.style.backgroundColor="#FFFFFF";
         curObj.style.color="#000000";
        }
       }
       else{
        if(curObj.children[0].children[0].checked){
         curObj.style.backgroundColor="#FFFFFF";
         curObj.style.color="#000000";
        }
        else{
         curObj.style.backgroundColor="#FFFFFF";
         curObj.style.color="#000000";
        }
       }
      }
      catch(err){
       return true;
      }
     }
    }
    </SCRIPT>

  • 相关阅读:
    tensorflow几个常见错误
    15、TDM模型
    算法97:成绩排名---动态规划
    推荐阅读论文
    Reservoir Sampling 蓄水池采样算法
    14、RALM: 实时 look-alike 算法在推荐系统中的应用
    NLP传统基础(3)---潜在语义分析LSA主题模型---SVD得到降维矩阵
    【SqlServer】SqlServer中的计算列
    【SQL】数据库中的五种约束
    【.NET】SqlDateTime 溢出。必须介于 1/1/1753 12:00:00 AM 和 12/31/9999 11:59:59 PM之间
  • 原文地址:https://www.cnblogs.com/cwy173/p/1782827.html
Copyright © 2011-2022 走看看