最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

鼠標(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)論

华阴市| 安仁县| 鹤庆县| 自治县| 淮南市| 林口县| 绥滨县| 长治县| 吴旗县| 广水市| 锦屏县| 长沙县| 敦化市| 枞阳县| 苍溪县| 遂川县| 昌都县| 横山县| 隆化县| 皮山县| 安达市| 松溪县| 平南县| 子长县| 东城区| 桓台县| 临湘市| 祁东县| 佛坪县| 成都市| 岳普湖县| 六盘水市| 新绛县| 镶黄旗| 南汇区| 扎兰屯市| 松江区| 龙江县| 正镶白旗| 阜城县| 灵台县|