zoukankan      html  css  js  c++  java
  • html---textarea初始化时就有个table空格以及tab键操作无效

    1 初始化时就有一个tab空格
        这是由于<textarea></textarea>之间的内容不为空的原因,包含空格和换行,否则浏览器会觉得空格或者换行都是文本域的内容。因此书写时需将<textarea></textarea>紧靠在一起。
    2 tab键对textarea操作无效
        在textarea中使用tab键时是无效的。会切换到还有一个控件上去,可是当我们有个须要时,要可以在文本域中使用tab键,可以使用javascript或者jquery方式实现:
        方式1:javascript
        tabIndent.js
        <script src="http://julianlam.github.com/tabIndent.js/js/tabIndent.js"></script><!-- 导入tabindent.js脚本-->
        <script>tabIndent.renderAll();</script><!-- 应用脚本-->
        在textarea标签中的class="tabIndent"
        实例:
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Test</title>

    <style type="text/css">
    .demo{600px; margin:30px auto; color:#51555c}
    .demo h3{height:32px; line-height:32px; font-size:18px}
    .demo h3 span{float:right; font-size:32px; font-family:Georgia,serif; color:#ccc;
    overflow:hidden}
    .demo textarea{600px;height:50px;}
    </style>

    <script src="tabIndent.js"></script>
    </head>
    <body>
        <div class="demo">
        <textarea name="saytxt" id="saytxt" class="tabIndent"></textarea>
        <script>tabIndent.renderAll();</script>
        </div>
    </body>
    </html>
        
  • 相关阅读:
    内存泄露之LeakCanary原理简析
    springboot(2.3.4)替换默认的logback为log4j2
    springboot-SPI-修改配置文件
    Vue组件
    米尔开发板测试记录
    调试米尔开发板记录
    linux操作GPIO命令
    linux操作PWM命令
    前端缓存(Storage)之有效期
    微信移动端判断二维码识别是否长按
  • 原文地址:https://www.cnblogs.com/zfyouxi/p/5204474.html
Copyright © 2011-2022 走看看