error| Error
This is the thing to write the JS script online, used to check the wrong things immediately!
That is, when the script is found to have a problem with the corresponding prompts, and in the Source code box highlighting error line, convenient debugging!
<ptml><pead><title>debug textarea</title><meta http-equiv= ' Content-Type ' content= ' text /html; charset=gb2312 ' ></pead><style>* {font-size:12px}body {margin:10px; Padding:0px}table.list{cursor: default;border:1px solid #ccccccbackground-color: #cccccc; Border-collapse:collapse;border-color: #cccccc;} </style><script language= "JavaScript" >//coded by Windy_sk <windy_sk@126.com> 20040205function ReportError (msg,url,line) {var str = ' You have found an error as below: \ n '; str = ' ERR: + msg + ' on line: + line;a Lert (str); return true;} Window.onerror = Reporterror;document.onkeydown = function () {if (Event.ctrlkey) {switch (event.keycode) {case 82:// Rruncode (); Break;case://ssavecode (); Break;case://ggoto (' Please input the line number ', ' 1 ') prompt //adocument.execcommand ("SelectAll"); Break;case://cdocument.execcommand ("Copy"); Break;case 88:// Xdocument.execcommand ("cut"); Break;case://VDOCUMENT.EXECCOmmand ("Paste"); Break;case://zdocument.execcommand ("Undo"); Break;case://ydocument.execcommand ("Redo"); Break;default:break;} Event.keycode = 0;event.returnvalue = false;} return;} function Show_ln () {var txt_ln = document.getElementById (' txt_ln '); var txt_main = document.getElementById (' Txt_main '); Txt_ln.scrolltop = Txt_main.scrolltop;while (txt_ln.scrolltop!= txt_main.scrolltop) {txt_ln.value + = (i++) + ' \ n '; txt_ Ln.scrolltop = Txt_main.scrolltop;} return;} function Edittab () {var code, SEL, tmp, r;event.returnvalue = False;sel = Event.srcElement.document.selection.createRange (); r = Event.srcElement.createTextRange (); switch (Event.keycode) { Case (8): if (!) ( Sel.getclientrects (). length > 1)) {event.returnvalue = True;return;} Code = SEL.TEXT;TMP = Sel.duplicate (); Tmp.movetopoint (R.getboundingclientrect (). Left, Sel.getclientrects () [0].top); if (Sel.parentelement ()!= tmp.parentelement ()) return;; Sel.setendpoint (' Starttostart ', tmp); sel.text = Sel.text.replace (/^\t/gm, ""); code = Code.replace (/^\T/GM, '). Replace (/\r\n/g, ' \ R '); R.findtext (code); R.select (); Break;case (9): if (sel.getclientrects (). length > 1 {code = SEL.TEXT;TMP = Sel.duplicate (); Tmp.movetopoint (R.getboundingclientrect (). Left, Sel.getclientrects () [0].top if (Sel.parentelement ()!= tmp.parentelement ()) return;sel.setendpoint (' Starttostart ', tmp); sel.text = ' \ t ' + Sel.text.replace (/\r\n/g, ' \r\t '); code = code.replace (/\r\n/g, ' \r\t '); R.findtext (code); R.select ();} Else{sel.text = ' \ t '; Sel.select ();} Breakcase (): tmp = Sel.duplicate (); Tmp.movetopoint (R.getboundingclientrect (). Left, Sel.getclientrects () [0].top); if (Sel.parentelement ()!= tmp.parentelement ()) return;tmp.setendpoint (' Endtoend ', sel); sel.text = ' \ r \ n ' + Tmp.text.replace (Tmp.text.replace (/^[\t]+/g, ""), ""); Sel.select (); break;default:event.returnvalue = True;break;} return;} function RunCode () {var str = document.getElementById ("Txt_main"). Value;var Code_win = window.open (' About:blank '); code _win.document.open (); Code_win.document.writeln ("<script>");Code_win.document.writeln ("function ReportError (msg,url,line) {\nline-=14;\nvar str= ' you have found an error as below: \ \n\\n '; \nstr+= ' Err: ' +msg+ ' on line: ' + [line]; \nalert (str); \nopener.goto (line); \nopener.focus (); \nwindow.onerror= Null;\nsettimeout (' Self.close () ', ten); \nreturn true;\n} "); Code_win.document.writeln (" window.onerror = ReportError; "); Code_win.document.writeln ("<\/script>"); Code_win.document.writeln (str); Code_win.document.close (); return;} function Savecode () {var str = document.getElementById ("Txt_main"). Value;var Code_win = window.open (' About:blank ', ' _ Blank ', ' top=10000 '); Code_win.document.open (); Code_win.document.writeln (str); Code_win.document.close (); Code_ Win.document.execCommand (' SaveAs ', ', ', ' code.html '); Code_win.close (); function Goto (LN) {if (!/^\d+$/.test (ln) | | ln==0) Return;var obj = document.getElementById ("Txt_main"); var rng = Obj.crea Tetextrange (); var arr = Obj.value.split (/\n/); if (ln>arr.length) ln = Arr.length;var str_tmp = ""; for (var i=0; I<ln-1; i++) {str_tmp + = Arr[i];} Rng.movestart (' character ', str_tmp.length); str_tmp = "" For (I=LN; i<arr.length; i++) {str_tmp + = Arr[i];} Rng.moveend (' character ',-str_tmp.length); Rng.select (); Window.onload = function () {document.getElementById ("Txt_main"). Value = "<script>\nalert (') \n<\/script> ";} </script><body><table width= ' class= ' list ' border= ' 1 ' bgcolor= ' #eeeeee ' bordercolorlight= ' 000000 ' bordercolordark= ' #FFFFFF ' cellpadding= ' 0 ' cellspacing= ' 0 ' > <tr bgcolor= ' #cccccc ' > <td colspan= ' 2 ' height= ' align= ' center ' ><b>debug textarea</b></td> </tr> <tr> <td colspan= ' 2 ' > <table width= ' border= ' 0 ' align= ' center ' > <tr> <td align= ' center ' ><br/> <textarea id= ' txt_ln ' name= ' content ' rows= ' style= ' width:40px;overflow:hidden;height:200px;border-right:0px; Text-align:right;line-height:14px ' onselectstart= ' This.nextSibling.focus (); return false ' ReaDonly></textarea><textarea id= ' txt_main ' name= ' content ' rows= ' ' cols= ' > </t d> </tr> </table> </td> </tr></table></BODY></HTML>