zoukankan      html  css  js  c++  java
  • textarea焦点的用法

    1.文本框显示默认文字:


    <textarea>白鸽男孩</textarea> 
    <textarea>白鸽男孩</textarea>
      2.鼠标点击文本框,默认文字消失:


    <textarea onfocus=”if(value==’白鸽男孩’) {value=’ ‘}”>白鸽男孩</textarea> 
    <textarea onfocus=”if(value==’白鸽男孩’) {value=’ ‘}”>白鸽男孩</textarea>
      3.鼠标移至文本框,默认文字消失:


    <textarea onmouseover=”focus()” onfocus=”if(value==’白鸽男孩’) {value=’ ‘}”>白鸽男孩</textarea> 
    <textarea onmouseover=”focus()” onfocus=”if(value==’白鸽男孩’) {value=’ ‘}”>白鸽男孩</textarea>
      4.鼠标点击文本框,默认文字消失,点击文本框外任意区域,默认文字又重现:


    <textarea onfocus=”if(value==’白鸽男孩’) {value=’ ‘}” onblur=”if(value==’ ‘) {value=’白鸽男孩’}”>白鸽男孩</textarea> 
    <textarea onfocus=”if(value==’白鸽男孩’) {value=’ ‘}” onblur=”if(value==’ ‘) {value=’白鸽男孩’}”>白鸽男孩</textarea>
      5.鼠标移至文本框,默认文字消失,鼠标移出文本框,默认文字又重现:


    <textarea onmouseover=”focus()” onfocus=”if(value==’白鸽男孩’) {value=’ ‘}” onmouseout=”blur()” onblur=”if (value==’ ‘) {value=’白鸽男孩’}”>白鸽男孩</textarea> 
    <textarea onmouseover=”focus()” onfocus=”if(value==’白鸽男孩’) {value=’ ‘}” onmouseout=”blur()” onblur=”if (value==’ ‘) {value=’白鸽男孩’}”>白鸽男孩</textarea>
      6.鼠标单击文本框,文本框内任何文字消失(包括默认文字及后来输入的文字):


    <textarea onclick=”value=’ ‘”>白鸽男孩</textarea> 
    <textarea onclick=”value=’ ‘”>白鸽男孩</textarea>
      7.鼠标移至文本框,文本框内任何文字消失(包括默认文字及后来输入的文字):


    <textarea onmouseover=”value=’ ‘”>白鸽男孩</textarea> 
    <textarea onmouseover=”value=’ ‘”>白鸽男孩</textarea>
      8.单击文本框后全选文本框内的文字:


    <textarea onfocus=”select()”>白鸽男孩</textarea> 
    <textarea onfocus=”select()”>白鸽男孩</textarea>
      9.鼠标移至文本框全选文本框内的文字:


    <textarea onmouseover=”focus()” onfocus=”select()”>白鸽男孩</textarea> 
    <textarea onmouseover=”focus()” onfocus=”select()”>白鸽男孩</textarea>
      10.回车后焦点从当前文本框转移到下一个文本框:


    <textarea onkeydown=”if(event.keyCode==13)event.keyCode=9″>白鸽男孩</textarea> 
    <textarea onkeydown=”if(event.keyCode==13)event.keyCode=9″>白鸽男孩</textarea>
      11.回车后焦点从当前文本框转移到指定位置:


    <textarea onkeypress=”return focusNext(this,’指定位置的id名称’,event)”>白鸽男孩</textarea>

    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    WinJS Clipboard
    -ms-grid -ms-grid-rows -ms-grid-row -ms-grid-columns -ms-grid-column
    严格模式 (JavaScript)
    windows rt 扫描二维码
    winmd文件和dll文件的区别
    Windows store 验证你的 URL http:// 和 https:// ms-appx:/// ms-appdata:///local
    使用C#在Windows应用商店程序中获取CPU信息
    python面向对象基础-01
    python红蓝英雄大乱斗(面向对象实现)
    python购物车升级版
  • 原文地址:https://www.cnblogs.com/shipeng22022/p/4614140.html
Copyright © 2011-2022 走看看