首页 > 代码库 > HTML文本框样式

HTML文本框样式

 1 输入框景背景透明:
 2 <input style="background:transparent;border:1px solid #ffffff">
 3  
 4 鼠标划过输入框,输入框背景色变色:
 5 <INPUT value="Type here" NAME="user_pass" TYPE="text" SIZE="29" onm ouseover="this.style.borderColor=‘black‘;this.style.backgroundColor=‘plum‘"
 6 style="width: 106; height: 21"
 7 onmouseout="this.style.borderColor=‘black‘;this.style.backgroundColor=‘#ffffff‘" style="border-width:1px;border-color=black">
 8  
 9 输入字时输入框边框闪烁(边框为小方型):
10 <Script Language="JavaScript">
11 function borderColor(){
12 if(self[oText].style.borderColor==red){
13 self[oText].style.borderColor = yellow;
14 }else{
15 self[oText].style.borderColor = red;
16 }
17 oTime = setTimeout(borderColor(),400);
18 }
19 </Script>
20 <input type="text" id="oText" style="border:5px dotted red;color:red" onfocus="borderColor(this);" onblur="clearTimeout(oTime);">
21  
22 输入字时输入框边框闪烁(边框为虚线):
23 <style>
24 #oText{border:1px dotted #ff0000;ryo:expression_r(onfocus=function light (){with(document.all.oText){style.borderColor=(style.borderColor=="#ffee00"?"#ff0000":"#ffee00");timer=setTimeout(light,500);}},onblur=function(){this.style.borderColor="#ff0000";clearTimeout(timer)})};
25 </style>
26 <input type="text" id="oText">
27  
28 自动横向廷伸的输入框:
29 <input type="text" style="huerreson:expression_r(this.width=this.scrollWidth)" value="abcdefghijk">
30  
31 自动向下廷伸的文本框:
32 <textarea name="content" rows="6" cols="80" onpropertychange="if(this.scrollHeight>80) this.style.posHeight=this.scrollHeight+5">输入几个回车试试</textarea>
33  
34 只有下划线的文本框:
35 <input style="border:0;border-bottom:1 solid black;background:;">
36  
37 软件序列号式的输入框:
38 <script for="T" event="onkeyup">
39 if(value.length==3)document.all[event.srcElement.sourceIndex+1].select();
40 </script>
41 <input name="T" size="5" maxlength="3"><input name="T" size="5" maxlength="3"><input name="T" size="5" maxlength="3"><input name="T" size="5" maxlength="3"><input name="T" size="5" maxlength="3"><input name="T7" size="5" maxlength="3">
42  
43 软件序列号式的输入框(完整版):
44 <script for="T" event="onkeyup">if(value.length==maxLength)document.all[event.srcElement.sourceIndex+1].focus();</script>
45 <script for="T" event="onfocus">select();</script>
46 <script for="Submit" event="onclick">
47 var sn=new Array();
48 for(i=0;i<T.length;i++)
49 sn=T.value;
50 alert(sn.join(""));
51 </script>
52 <input name="T" size="5" maxlength="3"><input name="T" size="5" maxlength="3"><input name="T" size="5" maxlength="3"><input name="T" size="5" maxlength="3"><input name="T" size="5" maxlength="3"><input name="T" size="5" maxlength="3">
53 <input type="submit" name="Submit">

 

HTML文本框样式