»
Tiếng AnhTiếng PhápTiếng Việt

In - Khung nhập liệu động - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Biểu mẫu » Vùng nhập liệu » Khung nhập liệu động
URL: https://www.javascriptbank.com/textbox-expander.html

Khung nhập liệu động © JavaScriptBank.comMột đoạn mã khác để tạo hiệu ứng làm một khung nhập liệu có kích thước thay đổi theo độ dài nhập liệu của người dùng.

Phiên bản đầy đủ: jsB@nk » Biểu mẫu » Vùng nhập liệu » Khung nhập liệu động
URL: https://www.javascriptbank.com/textbox-expander.html



JavaScript
<script>// Michael P. Hemmes (trueluck3@hotmail.com)function boxexpand(){// Code to make the script easier to use //boxValue=document.all.thebox.value.lengthboxSize=document.all.thebox.sizeminNum=20 // Set this to the MINIMUM size you want your box to be.maxNum=100 // Set this to the MAXIMUM size you want your box to be.// Starts the main portion of the script //if (boxValue > maxNum)  {  }else{  if (boxValue > minNum)    {      document.all.thebox.size = boxValue    }  else if (boxValue < minNum || boxValue != minNum)    {      document.all.thebox.size = minNum    }}}// End of script //</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form method="POST" action="--WEBBOT-SELF--"><input type="text" onKeypress="boxexpand()" name="thebox" size=20><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->