本文实例讲述了射流研究…实现当前输入框高亮显示的方法。分享给大家供大家参考。具体如下:
这里演示利用Java脚本语言技术实现的当前输入框高亮显示代码,在很多的网页表单中,当用户鼠标点击文本框的时候,该文本框就会显示高亮状态,提醒用户输入,本例通过爪哇岛描述语言代码实现了这样一种效果。
运行效果如下图所示:
在线演示地址如下:
http://demo.jb51.net/js/2015/js-table-input-color-show-codes/
具体代码如下:
!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN ' ' http://www .w3。org/TR/XHTML 1/DTD/XHTML 1-Transitional。DTD ' html xmlns=' http://www .w3。org/1999/XHTML ' hearteta http-equiv=' Content-Type ' Content=' text/html;charset=utf-8' /title当前输入框高亮显示/titlestyle正文,表单,h2,p,输入{ margin:0划水:0;} body { color : # 4f 4 F4 font :14 px/1.5 5 FAE 8f 6f 96 C5 9ed 1;}表单{ width:400px背景# fef4ebborder:2px实心# f60 padding-底部:10 px飞越:隐藏;zoom :1 margin 336010 px汽车;}表单H2 { color : # Fe 791 font-size :16 px;背景技术# ffebd7border-bottom:2px实心# f60padding:5px 10px }表格p { float:leftclear:both宽度:100%;height :31 pxmargin-top :10 px;线高:31 px}表单标签,表单输入{ float:left}表单标签{ width :100 pxh three :31 ext-align : right;}表单输入{ border :0 font-family : 5 FAE 8f 6f 96 C5 9ed 1;背景:url(input.png)不重复;}表单f .文本,形式f-text-high { width :203 px;高度:31px左衬垫:5 px线高:31 px}表单f-text-high {背景-位置:0-31px;}表单BTN { color : # fff;宽度宽度:104像素宽度:31像素指针:指针;font-size :16 px背景技术# f60线高:31 px边界半径:5像素;}/style脚本类型=' text/JavaScript '窗口。onload=function(){ var aInput=document。getelementsbytagname(' input ');var I=0;for(I=0;我想。长度-1;i ) { aInput[i].onfocus=function(){ this。类名=' f-text-high ' };输入[输入]。onb lur=function(){ this。类名=' f-text ' } } };/剧本/导演H2用户登录/h2 plabel用户名:/labelinput class=' f-text ' type=' text '/p plabel密码:/labelinput类=' f-text ' type=' password '/p plabel/labelinput类='f-btn '类型='button '值='登录//p/form/body/html希望本文所述对大家的爪哇岛描述语言程序设计有所帮助。