教程集 www.jiaochengji.com
教程集 >  脚本编程  >  javascript  >  正文 js 控制input输入框效果代码

js 控制input输入框效果代码

发布时间:2017-10-19   编辑:jiaochengji.com
教程集为您提供js 控制input输入框效果代码等资源,欢迎您收藏本站,我们将为您提供最新的js 控制input输入框效果代码资源
提示:您可以先修改部分代码再运行

<textarea name="runcool" rows="28" cols="75" > <html> <head> <title> JS_HomeWork </title> <meta http-equiv="content-type" content="text/html;charset=utf-8"/> <link href="1.css" rel="stylesheet" type="text/css"> <script type="text/javascript"> function f1(){ var input1 = document.getElementById("1"); input1.onmouseover = function(){this.style.backgroundColor="#FFE423"}; input1.onmouseout = function(){this.style.backgroundColor="#D3E9FC"}; input1.onclick = function(){this.style.backgroundColor="#FF6699"}; input1.onkeydown = function(){this.style.backgroundColor="#2B4780"}; var text1 = input1.defaultValue; var text2 = input1.value; if(text1!=text2){this.style.backgroundColor="#2B4780"} var input2 = document.getElementById("2"); input2.onmouseover = function(){this.style.backgroundColor="#FFE423"}; input2.onmouseout = function(){this.style.backgroundColor="#D3E9FC"}; input2.onclick = function(){this.style.backgroundColor="#FF6699"}; input2.onkeydown = function(){this.style.backgroundColor="#2B4780"}; var input3 = document.getElementById("3"); input3.onmouseover = function(){this.style.backgroundColor="#FFE423"}; input3.onmouseout = function(){this.style.backgroundColor="#D3E9FC"}; input3.onclick = function(){this.style.backgroundColor="#FF6699"}; input3.onkeydown = function(){this.style.backgroundColor="#2B4780"}; var input4 = document.getElementById("4"); input4.onmouseover = function(){this.style.backgroundColor="#FFE423"}; input4.onmouseout = function(){this.style.backgroundColor="#D3E9FC"}; input4.onclick = function(){this.style.backgroundColor="#FF6699"}; input4.onkeydown = function(){this.style.backgroundColor="#2B4780"}; var input5 = document.getElementById("5"); input5.onmouseover = function(){this.style.backgroundColor="#FFE423"}; input5.onmouseout = function(){this.style.backgroundColor="#D3E9FC"}; input5.onclick = function(){this.style.backgroundColor="#FF6699"}; input5.onkeydown = function(){this.style.backgroundColor="#2B4780"}; var input6 = document.getElementById("6"); input6.onmouseover = function(){this.style.backgroundColor="#FFE423"}; input6.onmouseout = function(){this.style.backgroundColor="#D3E9FC"}; input6.onclick = function(){this.style.backgroundColor="#FF6699"}; input6.onkeydown = function(){this.style.backgroundColor="#2B4780"}; var input7 = document.getElementById("7"); input7.onmouseover = function(){this.style.backgroundColor="#FFE423"}; input7.onmouseout = function(){this.style.backgroundColor="#D3E9FC"}; input7.onclick = function(){this.style.backgroundColor="#FF6699"}; input7.onkeydown = function(){this.style.backgroundColor="#2B4780"}; var input8 = document.getElementById("8"); input8.onmouseover = function(){this.style.backgroundColor="#FFE423"}; input8.onmouseout = function(){this.style.backgroundColor="#D3E9FC"}; input8.onclick = function(){this.style.backgroundColor="#FF6699"}; input8.onkeydown = function(){this.style.backgroundColor="#2B4780"}; var input9 = document.getElementById("9"); input9.onmouseover = function(){this.style.backgroundColor="#FFE423"}; input9.onmouseout = function(){this.style.backgroundColor="#D3E9FC"}; input9.onclick = function(){this.style.backgroundColor="#FF6699"}; input9.onkeydown = function(){this.style.backgroundColor="#2B4780"}; var input10 = document.getElementById("10"); input10.onmouseover = function(){this.style.backgroundColor="#FFE423"}; input10.onmouseout = function(){this.style.backgroundColor="#D3E9FC"}; input10.onclick = function(){this.style.backgroundColor="#FF6699"}; input10.onkeydown = function(){this.style.backgroundColor="#2B4780"}; var input11 = document.getElementById("11"); input11.onmouseover = function(){this.style.backgroundColor="#FFE423"}; input11.onmouseout = function(){this.style.backgroundColor="#D3E9FC"}; input11.onclick = function(){this.style.backgroundColor="#FF6699"}; input11.onkeydown = function(){this.style.backgroundColor="#2B4780"}; var input12 = document.getElementById("12"); input12.onmouseover = function(){this.style.backgroundColor="#FFE423"}; input12.onmouseout = function(){this.style.backgroundColor="#D3E9FC"}; input12.onclick = function(){this.style.backgroundColor="#FF6699"}; input12.onkeydown = function(){this.style.backgroundColor="#2B4780"}; var input13 = document.getElementById("13"); input13.onmouseover = function(){this.style.backgroundColor="#FFE423"}; input13.onmouseout = function(){this.style.backgroundColor="#D3E9FC"}; input13.onclick = function(){this.style.backgroundColor="#FF6699"}; input13.onkeydown = function(){this.style.backgroundColor="#2B4780"}; var input14 = document.getElementById("14"); input14.onmouseover = function(){this.style.backgroundColor="#FFE423"}; input14.onmouseout = function(){this.style.backgroundColor="#D3E9FC"}; input14.onclick = function(){this.style.backgroundColor="#FF6699"}; input14.onkeydown = function(){this.style.backgroundColor="#2B4780"}; var input15 = document.getElementById("15"); input15.onmouseover = function(){this.style.backgroundColor="#FFE423"}; input15.onmouseout = function(){this.style.backgroundColor="#D3E9FC"}; input15.onclick = function(){this.style.backgroundColor="#FF6699"}; input15.onkeydown = function(){this.style.backgroundColor="#2B4780"}; var input16 = document.getElementById("16"); input16.onmouseover = function(){this.style.backgroundColor="#FFE423"}; input16.onmouseout = function(){this.style.backgroundColor="#D3E9FC"}; input16.onclick = function(){this.style.backgroundColor="#FF6699"}; input16.onkeydown = function(){this.style.backgroundColor="#2B4780"}; } </script> </head> <body> <table onmouseover="f1()" id="d1" align="center"> <tr> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> </tr> </table>
</body> </html></textarea>
提示:您可以先修改部分代码再运行

您可能感兴趣的文章:
js控制文本框自动适应文本长度的例子
JS控制文本框只能输入N个字符代码
js控制textarea输入框根据内容自动适应高度
JS限制Textarea文本域字符个数的代码分享(图文)
javascript限制文本框textarea输入字数的代码
JS判断输入框不能为空代码
jquery实现input输入框实时输入触发事件代码
JQuery从头学起第三讲
js控制文本框只能输入整数或浮点数
js 检验(input、radio、checkbox、textarea)必填项的代码

[关闭]
~ ~