会员
众包
新闻
博问
闪存
云市场
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
opper
博客园
首页
博问
闪存
新随笔
订阅
管理
输入框里默认的文字为灰色
Code
<
style
>
html,body
{
margin
:
200px 400px
;
}
#search
{
color
:
#aaa
;
border
:
1px solid #CC0000
;
padding
:
1px
;
}
</
style
>
</
head
>
<
body
>
<
input
type
="text"
value
="请输入关键字"
id
="search"
/>
</
body
>
<
script
language
="javascript"
>
var
s
=
document.getElementById(
"
search
"
);
s.onfocus
=
function
(){
if
(
this
.value
==
this
.defaultValue)
this
.value
=
''
};
s.onblur
=
function
(){
if
(
/
^\s*$
/
.test(
this
.value)){
this
.value
=
this
.defaultValue;
this
.style.color
=
'
#aaa
'
}}
s.onkeydown
=
function
(){
this
.style.color
=
'
#333
'
}
</
script
>
外出网 www.waichu.net 发酷网 www.faako.com
posted on
2009-09-14 10:04
opper
阅读(
491
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
青丝网
脱发治疗
www.faako.com