当前位置: 代码迷 >> Web前端 >> 替textarea添加背景
  详细解决方案

替textarea添加背景

热度:383   发布时间:2012-11-23 00:03:43.0
为textarea添加背景
<form action="" method="post" id="MrJin" name="MrJin">
     <textarea name="MrJin_52CSS" id="MrJin_52CSS" cols="" rows=""></textarea>
     <input name="Submit" type="submit" value="Submit" />
</form>


<style>
<!--
#MrJin_52CSS {
     display:block;
     width:350px;
     height:240px;
     background:url(http://www.baidu.com/img/logo-yy.gif) no-repeat 10px 30px;
     border:1px solid #06f;
     padding:5px;
     }
-->   
</style>





<!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></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<style type="text/css">
.fab{width:440px;height:100px;font-size:12px;padding:3px;background: #f8f9ff url(http://www.linstyle.cn/website/template/linstyle/images/linstyle/footer.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>
<textarea name="v_content" id="v_content" class="fab"     onblur="this.className='fabtt'" onfocus="this.className='fabt'"     onkeydown="ctrlenterkey(event);" onfocus="if (securitycodejs!=null) {document.getElementById('showsecuritycode').innerHTML=securitycodejs; securitycodejs=null;}"></textarea>
</body>
</html>

?还有一种用CSS的:

<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN"   
"http://www.w3.org/TR/html4/loose.dtd">   
<html>   
<head>   
<meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">   
<title>无标题文档</title>   
<style   type="text/css">   
<!--   
.unnamed1   {   
background-image:   url(http://www.baidu.com/img/logo-yy.gif);   
}   
-->   
</style>   
</head>   
    
<body>   
<textarea   name="textarea"   class="unnamed1"></textarea>   
</body>   
</html>

?

  相关解决方案