Invocation mode
Createtextareawithlines (' Codetextarea ');
The number of lines on the left of the text edit box appears
function Createtextareawithlines (ID) {
var el = document.createelement (' DIV ');
var ta = document.getElementById (ID);
Ta.parentNode.insertBefore (el, TA);
El.appendchild (TA);
El.classname = ' textareawithlines ';
El.style.width = (Ta.offsetwidth + +) + ' px ';
ta.style.position = ' absolute ';
Ta.style.left = ' 30px ';
El.style.height = (Ta.offsetheight + 2) + ' px ';
El.style.overflow = ' hidden ';
el.style.position = ' relative ';
El.style.width = (Ta.offsetwidth + +) + ' px ';
var lineobj = document.createelement (' DIV ');
lineObj.style.position = ' absolute ';
LineObj.style.top = lineobjoffsettop + ' px ';
LineObj.style.left = ' 0px ';
LineObj.style.width = ' 27px ';
El.insertbefore (Lineobj, TA);
LineObj.style.textAlign = ' right ';
Lineobj.classname = ' lineobj ';
var string = ';
for (var no = 1; no < no++) {
if (String.Length > 0) String = string + ' <br> ';
String = string + No;
}
Ta.onkeydown = function () {positionlineobj (lineobj, TA);};
Ta.onmousedown = function () {positionlineobj (lineobj, TA);};
Ta.onscroll = function () {positionlineobj (lineobj, TA);};
Ta.onblur = function () {positionlineobj (lineobj, TA);};
Ta.onfocus = function () {positionlineobj (lineobj, TA);};
Ta.onmouseover = function () {positionlineobj (lineobj, TA);};
lineobj.innerhtml = string;
}
function positionlineobj (obj, ta) {
Obj.style.top = (Ta.scrolltop *-1 + lineobjoffsettop) + ' px ';
}
Line number displayed to the left of the text editor