html 文本输入框效果大汇集
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
1、选中去除文本框文字,离开后显示原有文字:
<
input
name
=
"key"
type
=
"text"
id
=
"key"
value
=
"关键词"
size
=
"30"
onmouseover
=
this
.focus();this.select();
onclick
=
"if(value==defaultValue){value='';this.style.color='#000'}"
onBlur
=
"if(!value){value=defaultValue;this.style.color='#999'}"
style
=
"color:#999"
/>
2、选中后方可编辑:
<
input
type
=
"checkbox"
name
=
"tpbox"
value
=
"1"
onclick
=
"if(this.checked) {txtNo.disabled=false}else{txtNo.disabled=true}"
>你一定要幸福,我会好好的!
你的姓名:<
input
type
=
"text"
name
=
"txtNo"
size
=
"20"
value
=
"选中前面的选项方可编辑"
disabled>
3、点击链接后方可编辑:
<
a
href
=
"#"
onclick
=
"username.readOnly=false;alert('你好,欢迎使用!')"
>先点击我哦!</
a
>
你的姓名:<
input
id
=
"username"
value
=
"--请输入--"
size
=
"30"
readOnly>
4、输入框从中间输入:从中间输入:
<
input
type
=
"text"
name
=
"mid"
style
=
"text-align:center;"
>
5、输入框变色:输入框改变变色:
<
input
type
=
"text"
size
=
"20"
style
=
" border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-size: 1em !important; min-height: auto !important; white-space: pre !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;">
|