欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

鼠標(biāo)經(jīng)過(guò)的文本框textbox變色

 更新時(shí)間:2009年05月21日 18:42:50   作者:  
文本框 textbox 變色
JS文件:
復(fù)制代碼 代碼如下:

function mouseAction() {
var textInputs = document.getElementsByTagName("input");
var len = textInputs.length;
var index = 0;
var textInput;
/*
也能用 for in 語(yǔ)句遍歷
for (textInput in textInputs){
textInputs[textInput].onmouseover = functionName;
}
*/
for( index = 0; index < len; index++ ) {
textInput = textInputs[index];
if( textInput.getAttribute("type") == "text" ){
textInput.onmouseover = function (){
//也能用這種方式 this.style.backgroundColor = "red";
this.className = "txtMouseOver"; //要先在HTML中引入CSS文件
}; //注意要加分號(hào)

textInput.onmouseout = function(){
this.className = "txtMouseOut";
};

textInput.onfocus = function(){
this.className = "txtMouseFocus";
};

textInput.onblur = function(){
this.className = "txtMouseBlur";
};
}
}
}

//也可以直接跟一個(gè)函數(shù)名,不要加引號(hào),括號(hào) window.onload = mouseAction;
window.onload = function(){
mouseAction();
};

CSS文件:
復(fù)制代碼 代碼如下:

/*主體居中顯示*/
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;
}

相關(guān)文章

最新評(píng)論