otomatik büyüyen textarea

Javascript kodları otomatik büyüyen textarea Hazır program kodları hakkında bilgi paylaş; denemenizi tavsiye ederim enter a bastıkça text alanı büyüyor aşağı doğru hatta demosunu gö...
Cevapla
 
Seçenekler
  #1  
Arama 25-11-2007, 09:38
banias - ait Kullanıcı Resmi (Avatar)
Pseudo Coder
Üyelik Tarihi: 23/08/07
Mesajlar: 1.207
 
     WS-Ticareti: (2)
Blog Yazıları: 2
Teşekkürleri: 9
98 Msg. 169 Tşkr.
Rep Gücü: 100 banias has much to be proud ofbanias has much to be proud ofbanias has much to be proud ofbanias has much to be proud ofbanias has much to be proud ofbanias has much to be proud ofbanias has much to be proud ofbanias has much to be proud of

otomatik büyüyen textarea

denemenizi tavsiye ederim enter a bastıkça text alanı büyüyor aşağı doğru
hatta demosunu gösterem :

head
HTML-Kodu:
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Paul Tuckey | http://tuckey.org/
Modified by: EZboy yuriy.demchenko at gmail.com */

function countLines(strtocount, cols) {
  var hard_lines = 1;
  var last = 0;
  while ( true ) {
    last = strtocount.indexOf("\n", last+1);
    hard_lines ++;
    if ( last == -1 ) break;
  }
  var soft_lines = Math.round(strtocount.length / (cols-1));
  var hard = eval("hard_lines  " + unescape("%3e") + "soft_lines;");
  if ( hard ) soft_lines = hard_lines;
  return soft_lines;
}

function cleanForm() {
  for(var no=0;no<document.forms.length;no++){
    var the_form = document.forms[no];
    for( var x in the_form ) {
      if ( ! the_form[x] ) continue;
      if( typeof the_form[x].rows != "number" ) continue;

      if(!the_form[x].onkeyup) {the_form[x].onkeyup=function()
      {this.rows = countLines(this.value,this.cols)+1;};the_form[x].rows =
      countLines(the_form[x].value,the_form[x].cols) +1;}
    }
  }
}

// Multiple onload function created by: Simon Willison
// http://simon.incutio.com/archive/2004/05/26/addLoadEvent
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(function() {
  cleanForm();
});
body (kullanım şekli)
HTML-Kodu:
<form> <textarea cols="40" rows="2" name="reason">Add more text to see it expand!</textarea> </form>
__________________
| | |
| |
|
|
|
Alıntı ile Cevapla
Cevapla


Seçenekler


Benzer Konular
Konu Konu Açanlar Forum Cevaplar Güncel Mesajlar
Büyüyen taşlar şaşırtıyor.. cunobag Haberler 1 08-06-2008 11:16
Textarea yı buton ile kopyala Miliotta Html kodları 0 12-03-2008 12:02
Formdan bilgi çekme (Textarea) B737 ASP 0 26-01-2008 03:50
<textarea>…</textarea> kadınca Html 0 18-12-2007 10:30
TextArea ile Form İşlemleri viper ASP 0 02-11-2007 05:50

Siteye link vermek için alttaki kodu sitenize ekleyin
Ya da kodu Ctrl+C ile kopyalayın
Örnek görünüm: Webmaster Sitesi