»
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/expanding-textbox.html

Khung nhập liệu động © JavaScriptBank.comHiệu ứng sẽ tạo 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/expanding-textbox.html



JavaScript
<SCRIPT LANGUAGE="JavaScript">// Robert Khatchadourian (sonic890@hotmail.com)<!-- Beginfunction call_me(max_length) {if((document.form1.mybox.value == null ) || (document.form1.mybox.value == "" )) document.form1.mybox.size = size;if((document.form1.mybox.value.length >= size)&&(document.form1.mybox.value.length <= max_length)) document.form1.mybox.size = document.form1.mybox.value.length + 1;else document.form1.mybox.size = size;}//  End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form name="form1">LastName: <input type="text" style="font-family: Terminal" name="mybox" maxlength="30" size="10" onFocus="setInterval('call_me(document.form1.mybox.maxLength)', 1)"><!--/style needs to be a font that has a fixed size attribute like TERMINAL/--></form><SCRIPT LANGUAGE="JavaScript"><!-- Beginvar size = document.form1.mybox.size; //Global Variable keeps original size//  End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->