textInput.onmouseout = function(){
this.className = "txtMouseOut";
};
textInput.onfocus = function(){
this.className = "txtMouseFocus";
};
textInput.onblur = function(){
this.className = "txtMouseBlur";
};
}
}
}
//也可以直接跟一个函数名,不要加引号,括号 window.onload = mouseAction;
window.onload = function(){
mouseAction();
};
CSS文件:
代码如下:
/*主体居中显示*/
body{
width: 80%;
height: 800px;
position: relative;
margin-left: 10%;
/*left: -40%;*/
border: #00CCFF solid thin;
}
.txtMouseOver
{
border-color: #9ecc00;
}
.txtMouseOut
{
border-color: #84a1bd;
}
.txtMouseFocus
{
border-color: #9ecc00;
background-color: #e8f9ff;
}
.txtMouseBlur
{
border-color: #84a1bd;
background-color: #ffffff;
}