source: extensions/url_uploader/template/createTextareaWithLines.js @ 19804

Last change on this file since 19804 was 19804, checked in by mistic100, 11 years ago

add plugin URL Uploader

File size: 1.4 KB
Line 
1function createTextAreaWithLines(id) {
2  var el = document.createElement('TEXTAREA');
3  var ta = document.getElementById(id);
4
5  el.style.resize = 'none';
6  ta.style.resize = 'none';
7  ta.wrap = 'off';
8
9  var string = '';
10  for (var no=1;no<1000;no++) {
11    if (string.length>0) string += '\n';
12    string += no;
13  }
14 
15  el.className      = 'textAreaWithLines';
16  el.style.height   = (ta.offsetHeight-3) + "px";
17  el.style.display  = "block";
18  el.style.width    = "25px";
19  el.style.position = "absolute";
20  el.style.overflow = 'hidden';
21  el.style.textAlign = 'right';
22  el.style.paddingRight = '0.2em';
23  el.innerHTML      = string;  //Firefox renders \n linebreak
24  el.innerText      = string; //IE6 renders \n line break
25  el.style.zIndex   = 0;
26  el.style.border   = "none";
27  el.style.background = "none";
28 
29  ta.style.marginLeft = "20px"
30  ta.style.zIndex   = 1;
31  ta.style.position = "relative";
32  ta.parentNode.insertBefore(el, ta.nextSibling);
33
34  setLine();
35  ta.onkeydown    = function() { setLine(); }
36  ta.onmousedown  = function() { setLine(); }
37  ta.onscroll     = function() { setLine(); }
38  ta.onblur       = function() { setLine(); }
39  ta.onfocus      = function() { setLine(); }
40  ta.onmouseover  = function() { setLine(); }
41  ta.onmouseup    = function() { setLine(); }
42
43  function setLine() {
44    el.scrollTop   = ta.scrollTop;
45    el.style.top   = (ta.offsetTop) + "px";
46    el.style.left  = (ta.offsetLeft - 27) + "px";
47  }
48}
Note: See TracBrowser for help on using the repository browser.