用JS实现TextArea水印的效果

来源:互联网 发布:tensorflow 验证码识别 编辑:程序博客网 时间:2024/05/17 07:21

 

以下代码可直接运行

 

<script language="javascript" >


function clickruncode(){
  if(document.getElementById("runcode0").value=='请在此帖入代码')
     document.getElementById("runcode0").value='';
  }

function blurruncode()
{
  if(document.getElementById("runcode0").value=='')
      document.getElementById("runcode0").value='请在此帖入代码';
}

</script>

 <table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-bottom:8px">
     <tr>
      <td>
       <textarea name="textcode" id="runcode0" cols="37" rows="12" onblur="blurruncode()" onclick="clickruncode()">请在此帖入代码</textarea>
      </td>
     
    </tr>
   
   </table>

原创粉丝点击