textarea中显示默认内容,同时在中间单击鼠标后默认内容消失,填写完东西后,再次单击正常
<table width= "80% " align= "center ">
<tr bgcolor= "lightblue ">
<td width= "10% " align= "center ">
<b> 工程名称 </b>
</td>
<td width= "20% "> </td>
</tr>
<tr>
<td align= "center "> 填写评价报告内容 </td>
<td>
<textarea rows= "5 " cols= "50 " onclick= "this.select() "> 在此处填写内容 </textarea>
</td>
</tr>
</table>
------解决方案--------------------
<script language= "JavaScript ">
<!--
function WriteSth()
{
if (area_id.value== "在此处填写内容 ")
{
area_id.value = " ";
}
}
//-->
</script>
<body>
<table width= "80% " align= "center ">
<tr bgcolor= "lightblue ">
<td width= "10% " align= "center ">
<b> 工程名称 </b>
</td>
<td width= "20% "> </td>
</tr>
<tr>
<td align= "center "> 填写评价报告内容 </td>
<td>
<textarea id= 'area_id ' rows= "5 " cols= "50 " onclick= "WriteSth() "> 在此处填写内容 </textarea>
</td>
</tr>
</table>
</body>
------解决方案--------------------
如果我的评价报告内容就是"在此处填写内容"这段,怎么办?
------解决方案--------------------
<html>
<head>
<script type= "text/javascript ">
var i=0;
function fn1(obj)
{
if(obj.value== "在此处填写内容 " && i==0) obj.value= " ";
}
function fn2(obj)
{
if(obj.value== " "){obj.value= "在此处填写内容 ";i=0;}
}
function fn3(obj){i=1;}
</script>
</head>
<body>
<textarea id= "txt " rows= "5 " cols= "50 " onfocus= "fn1(this) " onblur= "fn2(this) " onchange= "i=1 "> 在此处填写内容 </textarea>
</body>
</html>