This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 15th, 2012  |  syntax: None  |  size: 1.35 KB  |  views: 36  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <script type="text/javascript">
  2. var observe;
  3. if (window.attachEvent) {
  4.     observe = function (element, event, handler) {
  5.         element.attachEvent('on'+event, handler);
  6.     };
  7. }
  8. else {
  9.     observe = function (element, event, handler) {
  10.         element.addEventListener(event, handler, false);
  11.     };
  12. }
  13. function init () {
  14.     var text = document.getElementById('comment');
  15.     function resize () {
  16.         text.style.height = 'auto';
  17.         text.style.height = text.scrollHeight+'px';
  18.     }
  19.     /* 0-timeout to get the already changed text */
  20.     function delayedResize () {
  21.         window.setTimeout(resize, 0);
  22.     }
  23.     observe(text, 'change',  resize);
  24.     observe(text, 'cut',     delayedResize);
  25.     observe(text, 'paste',   delayedResize);
  26.     observe(text, 'drop',    delayedResize);
  27.     observe(text, 'keydown', delayedResize);
  28.  
  29.     text.focus();
  30.     text.select();
  31.     resize();
  32. }
  33. </script>
  34. </head>
  35. <body onload="init();">
  36.  
  37.  
  38.  
  39. <form enctype="application/x-www-form-urlencoded" action="submitcomment.php" method="post" target="output_frame" name="kommentti" id="kommentti">
  40.         <textarea name="comment" rows="1" id="comment" onkeypress="return submitViaEnter(event)" autocomplete="off"></textarea>
  41.         <input type="hidden" name="hiddenid" id="hiddenid" value="<?php echo $prepare_data['post_id']; ?>" />
  42.         </form>
clone this paste RAW Paste Data