html---textarea初始化時就有個table空格以及tab鍵操作無效,textarea空格

來源:互聯網
上載者:User

html---textarea初始化時就有個table空格以及tab鍵操作無效,textarea空格
1 初始化時就有一個tab空格    這是因為<textarea></textarea>之間的內容不為空白的原因,包括空格和換行,否則瀏覽器會認為空白格或者換行都是文本域的內容,因此書寫時需將<textarea></textarea>緊靠在一起;2 tab鍵對textarea操作無效    在textarea中使用tab鍵時是無效的,會切換到另一個控制項上去,但是當我們有個需要時,要能夠在文本域中使用tab鍵,可以使用javascript或者jquery方式實現:    方式1:javascript        <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{width: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{width: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>
    

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.