---
title: "少用但实用js和css整理中"
author: "vtyi"
date: "2009-12-24T22:23:01Z"
tags: []
categories: ["Web前端"]
slug: "js-css"
draft: false
lastmod: "2010-01-29T22:15:07Z"
id: 556107
url: "https://vtyi.iteye.com/blog/556107"
---

控制字符长度过长换行：&lt;TD style="vertical-align:top; COLOR: #333; BORDER-BOTTOM: #e3deb8 2px solid;BORDER-RIGHT: #e3deb8 2px solid;word-wrap:break-word;overflow:auto;" class="dataCell" scope=row&gt;

 

&lt;TD class="dataCell" style="vertical-align:top; COLOR: #333; BORDER-BOTTOM: #e3deb8 2px solid;BORDER-RIGHT: #e3deb8 2px solid;"&gt;

鼠标在表格上移动变色：&lt;TR class=" dataRow even first"

onblur="if (window.hiOff){hiOff(this);}"

onmouseover="if (window.hiOn){hiOn(this);}"

onfocus="if (window.hiOn){hiOn(this);}"

onmouseout="if (window.hiOff){hiOff(this);}" id="dd"&gt;，页面数据多好像会很慢

或者

#DataGrid1 tr {  
cursor:hand;  
height:20px;  
background-color: expression(this.sectionRowIndex % 2 == 0 ? "#EEF3F7" : "#F0F0FF" );  
TableSelect: expression(  
onmouseover = function()  
{  
this.style.backgroundColor =  
(  
this.style.backgroundColor != "#69cdff" ? "#69cdff" : (this.sectionRowIndex % 2 == 0 ? "#EEF3F7" : "#F0F0FF")  
);  
},  
onmouseout = function()  
{  
this.style.backgroundColor =  
(  
this.style.backgroundColor != "#69cdff" ? "#69cdff" :(this.sectionRowIndex % 2 == 0 ? "#EEF3F7" : "#F0F0FF")  
)  
}  
);  
}

 

select多选控制

&lt;script&gt;  
var tempMatch = new Array();  
var tempNoMatch = new Array();  
var count=0;  
var mark=false;  
function matchMoveselect(matchedId){   
    var matched = document.getElementById(matchedId);   
    var temp = new Array();  
    var j=0;     
    if(count==0){  
        for(i=0;i &lt;matched.options.length;i++){  
            tempMatch\[i]=new Option(matched.options\[i].text,matched.options\[i].value);               
        }         
    }  
    count++;  
    for(i=0;i &lt;matched.options.length;i++){  
        if(matched.options\[i].selected){  
            mark=true;  
            //noMatched.options\[noMatched.options.length]=new Option(matched.options\[i].text,matched.options\[i].value);  
            temp\[j]=i;       
            j++;  
        }       
    }  
    for(i=0;i &lt;=temp.length;i++)    {  
        matched.options\[temp\[i]-i]=null;   
    }   
     
}

&lt;/script&gt;

/\*添加select模板参考

var sAgent = navigator.userAgent.toLowerCase() ;  
   
    // Internet Explorer  
    if ( sAgent.indexOf("msie") != -1 && sAgent.indexOf("mac") == -1 && sAgent.indexOf("opera") == -1 )  
    {  
        if(flag){   
            var sleold=oldstr.options.length;             
              var slenew=vect.size();  
            oldstr.options.length=0;       
            for(var i=0;i &lt;slenew;i++){  
                var moPtion=window.opener.document.createElement("OPTION");       
                moPtion.text=map.get(vect.get(i));             
                moPtion.value=vect.get(i);  
                if(!oldstr.contains(moPtion)){  
                    oldstr.add(moPtion);   
                }                                 
            }       
        }  
    }else{  
        if(flag){       
            var slenew=vect.size();       
            for(var i=0;i &lt;slenew;i++){                         
                oldstr.options\[i]=new Option(map.get(vect.get(i)),vect.get(i));                         
            }       
          }  
    }

\*/end

&lt;select name="signatory" ondblclick="matchMoveselect('selFile');"  multiple="multiple" style="width:300" id="selFile"&gt;

&lt;option value="100"&gt;Winston , &lt;/option&gt;

&lt;/select&gt;

&lt;input name="rightMove" type="button" class="button"  
                  value="Remove" onClick="matchMoveselect('selFile');"&gt;