交互设计中心-72色

交互设计中心 | 用户体验 | 优化

优化textarea的样式---背景图片的实现

2009年7月27日 | 分类:jquery/javascript | 评论:0 | 引用:0 | | Tags:textarea  优化  

1,初始状态:

当鼠标点进去写东西的时候,如下图:

默认用了一个bg图片,在文本框获得一次焦点后把背景图片去掉了,后来再失去焦点的时候用的是第三个样式。
代码是copy下来的,图片路径修改成了绝对路径。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cn" lang="cn">
<head>
<title>输入框textarea提示点击消失效果 - 时代前端</title>
<meta http-equiv="content-type" content="text/html; charset=GBK"/>
<style type="text/css">
.fab{width:440px;height:100px;font-size:12px;padding:3px;background: #f8f9ff url(upload/201004021148272647.gif) no-repeat 0 -222px;border: 1px solid #c4c9fd;color:#6C63A3}
.fabt{width:440px;height:100px;font-size:12px;padding:3px;border:1px solid #f7ca06;background:#fffbca;color:#cb6a24}
.fabtt{width:440px;height:100px;font-size:12px;padding:3px;background: #f8f9ff;border: 1px solid #c4c9fd;color:#6C63A3}
</style>
<script type="text/javascript" language="javascript">
</script>
</head>
<body>
<div style="margin-bottom:10px;">由时代前端收集整理 <a href=http://www.52shidai.com _fcksavedurl="http://www.52shidai.com" _fcksavedurl="http://www.52shidai.com">http://www.52shidai.com/ 时代前端</a></div>
<textarea class="fab"  onblur="this.className='fabtt'" onfocus="this.className='fabt'"  onkeydown="ctrlenterkey(event);" onfocus="if (securitycodejs!=null) {document.getElementById('showsecuritycode').innerHTML=securitycodejs; securitycodejs=null;}">
</body>
</html>
Share
« 全国09年7月22日-日全食、日偏食时间表及观测方法jQuery 1.3.3 新功能 »



◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。