搜索
首页web前端js教程JS代码格式化和语法着色V2_javascript技巧

升级到第二版,开一贴以示庆贺,哈哈哈

自 Ver1.1 升级内容
1. 增加函数列表
2. 增加函数 Export 功能
3. 增加函数依存关系分析 (这个功能个人未见其他软件实现过,自己创意,问题多多,目前分析能力还是比较有限的,只能分析全局函数依存关系,可能在复杂代码的情况下出现 bug)
4. 修正 for 语句分析 bug
5. 修正 语法折叠的 bug
6. 改进 Collapse All ※ Expand All 函数工作方式,避免行数太大时的死机
7. 改进行号分析机制,避免行数太大时的死机

复制代码 代码如下:



JSer Ver 2.0


<script> <BR>/********************** <BR> Author: Hutia <br><br>*********************/ <br><br>window.onload=init; <br><br><BR>//------------------ <BR>// Static Variable <BR>//------------------ <br><br>var KEYWORDS="abstract break byte case catch char class const continue default delete do double else extends false final <BR>finally float for function goto if implements import in instanceof int interface long native null package private protected <BR>public reset return short static super switch synchronized this throw transient true try var void while with"; <BR>var OBJECTS="Anchor Applet Area Arguments Array Boolean Button Checkbox Collection Crypto Date Dictionary Document Drive <BR>Drives Element Enumerator Event File FileObject FileSystemObject FileUpload Folder Folders Form Frame Function Global Hidden <BR>History HTMLElement Image Infinity Input JavaArray JavaClass JavaObject JavaPackage JSObject Layer Link Math MimeType <BR>Navigator Number Object Option Packages Password Plugin PrivilegeManager Random RegExp Screen Select String Submit Text <BR>Textarea URL VBArray Window WScript"; <BR>var METHODS_PROPERTIES="above abs acos action activeElement alert alinkColor all altKey anchor anchors appCodeName applets <BR>apply appName appVersion arguments arity asin assign atan atan2 atob availHeight availLeft availTop availWidth ActiveXObject <BR>back background below bgColor big blink blur bold border borderWidths bottom btoa button call callee caller cancelBubble <BR>captureEvents ceil charAt charCodeAt charset checked children classes className clear clearInterval clearTimeout click <BR>clientInformation clientX clientY close closed colorDepth compile complete concat confirm constructir contains contextual <BR>cookie cos crypto ctrlKey current data defaultCharset defaultChecked defaultSelected defaultStatus defaultValue description <BR>disableExternalCapture disablePrivilege document domain E Echo element elements embeds enabledPlugin enableExternalCapture <BR>enablePrivilege encoding escape eval event exec exp expando FromPoint fgColor fileName find fixed floor focus fontColor <BR>fontSize form forms forward frames fromCharCode fromElement getAttribute get getClass getDate getDay getFullYear getHours <BR>getMember getMilliseconds getMinutes getMonth getSeconds getSelection getSlot getTime getTimezoneOffset getUTCDate getUTCDay <BR>getUTCFullYear getUTCHours getUTCMilliseconds getUTCMinutes getUTCMonth getUTCSeconds getWindow getYear global go HandleEvent <BR>Height hash hidden history home host hostName href hspace id ids ignoreCase images index indexOf inner innerHTML innerText <BR>innerWidth insertAdjacentHTML insertAdjacentText isFinite isNAN italics java javaEnabled join keyCode Links LN10 LN2 LOG10E <BR>LOG2E lang language lastIndex lastIndexOf lastMatch lastModified lastParen layers layerX layerY left leftContext length link <BR>linkColor load location locationBar log lowsrc MAX_VALUE MIN_VALUE margins match max menubar method mimeTypes min modifiers <BR>moveAbove moveBelow moveBy moveTo moveToAbsolute multiline NaN NEGATIVE_INFINITY name navigate navigator netscape next <BR>number offscreenBuffering offset offsetHeight offsetLeft offsetParent offsetTop offsetWidth offsetX offsetY onabort onblur <BR>onchange onclick ondblclick ondragdrop onerror onfocus onHelp onkeydown onkeypress onkeyup onload onmousedown onmousemove <BR>onmouseout onmouseover onmouseup onmove onreset onresize onsubmit onunload open opener options outerHeight outerHTML <BR>outerText outerWidth POSITIVE_INFINITY PI paddings pageX pageXOffset pageY pageYOffset parent parentElement parentLayer <BR>parentWindow parse parseFloat parseInt pathname personalbar pixelDepth platform plugins pop port pow preference previous <BR>print prompt protocol prototype push random readyState reason referrer refresh releaseEvents reload removeAttribute <BR>removeMember replace resizeBy resizeTo returnValue reverse right rightcontext round SQRT1_2 SQRT2 screenX screenY scroll <BR>scrollbars scrollBy scrollIntoView scrollTo search select selected selectedIndex self setAttribute setDay setFullYear <BR>setHotkeys setHours setInterval setMember setMilliseconds setMinutes setMonth setResizable setSeconds setSlot setTime <BR>setTimeout setUTCDate setUTCFullYear setUTCHours setUTCMillseconds setUTCMinutes setUTCMonth setUTCSeconds setYear <BR>setZOptions shift shiftKey siblingAbove siblingBelow signText sin slice smallsort source sourceIndex splice split sqrt src <BR>srcElement srcFilter status statusbar stop strike style sub submit substr substring suffixes sun sup systemLanguage TYPE <BR>tagName tags taint taintEnabled tan target test text title toElement toGMTString toLocaleString toLowerCase toolbar top <BR>toString toUpperCase toUTCString type typeOf UTC unescape unshift untaint unwatch userAgent userLanguage value valueOf <BR>visibility vlinkColor vspace watch which width window write writeln x y zIndex"; <BR>var OPS="! $ % & * + - // / : < = > ? [ ] ^ | ~ is new sizeof typeof unchecked"; <br><br>var regKW=new RegExp("(\\W"+KEYWORDS.replace(/ /g,"$)|(\\W")+"$)","g"); <BR>var regObj=new RegExp("(\\W"+OBJECTS.replace(/ /g,"$)|(\\W")+"$)","g"); <BR>var regMP=new RegExp("(\\W"+METHODS_PROPERTIES.replace(/ /g,"$)|(\\W")+"$)","g"); <BR>//var regOP=new RegExp("(\\W"+OPS.replace(/ /g,"$)|(\\W")+"$)","g"); <br><br>//------------------ <BR>// Global Variables <BR>//------------------ <BR>var divJSInput, txtJSInput, divMain, divJSOutputLineNo, divJSOutputPlus, divJSOutput, divWaiting; <BR>var spnProcess, cmdStop, divJSExport, selJSExport, divJSExportContent; <BR>var glbStr, glbP, glbRe, curRe, glbTimer, glbBusy, glbFuntionNames; <br><br><BR>function init(){ <BR> // init global variables <BR> divJSInput=document.getElementById("divJSInput"); <BR> txtJSInput=document.getElementById("txtJSInput"); <BR> divMain=document.getElementById("divMain"); <BR> divJSOutputLineNo=document.getElementById("divJSOutputLineNo"); <BR> divJSOutputPlus=document.getElementById("divJSOutputPlus"); <BR> divJSOutput=document.getElementById("divJSOutput"); <BR> divWaiting=document.getElementById("divWaiting"); <BR> spnProcess=document.getElementById("spnProcess"); <BR> cmdStop=document.getElementById("cmdStop"); <BR> divJSExport=document.getElementById("divJSExport"); <BR> selJSExport=document.getElementById("selJSExport"); <BR> divJSExportContent=document.getElementById("divJSExportContent"); <br><br> // init window state <BR> maximizeWindow(); <br><br> divMain.style.width=document.body.clientWidth-4; <BR> divMain.style.height=document.body.clientHeight-26; <br><br> divJSOutput.style.width=document.body.clientWidth-72; <br><br> <BR> // init global events <br><br>divJSOutputLineNo.onselectstart=divJSOutputLineNo.onselect=divJSOutputPlus.onselectstart=divJSOutputPlus.onselect=cancelEvent <br><br> divJSOutput.onscroll=divJSOutput_onscroll; <br><br> divJSInput.onkeydown=divJSInput_keydown; <BR> divJSExport.onkeydown=divJSExport_keydown; <br><br>} <br><br><BR>//------------------ <BR>// event scripts <BR>//------------------ <br><br>function cancelEvents(e){ <BR> var e=window.event?window.event:e; <BR> e.returnValue=false; <BR> return(false); <BR>} <br><br>function divJSInput_keydown(e){ <BR> var e=window.event?window.event:e; <BR> var srcEle=e.srcElement?e.srcElement:e.target; <BR> var sel; <BR> if(e.keyCode==27)hideJSInput(); <BR> if(e.keyCode==13&&e.ctrlKey)execJSInput(); <BR> if(e.keyCode==9&&srcEle==txtJSInput){ <BR> document.selection.createRange().text="\t";return(false); // not support FF <BR> } <BR>} <br><br>function divJSExport_keydown(e){ <BR> var e=window.event?window.event:e; <BR> var srcEle=e.srcElement?e.srcElement:e.target; <BR> var sel; <BR> if(e.keyCode==27)hideJSExport(); <BR> if(e.keyCode==13&&e.ctrlKey)hideJSExport(); <BR>} <br><br>function divJSOutput_onscroll(){ <BR> divJSOutputLineNo.scrollTop=divJSOutputPlus.scrollTop=divJSOutput.scrollTop; <BR>} <br><br><br><br>//------------------ <BR>// functional scripts <BR>//------------------ <br><br>function showJSInput(){ <BR> if(glbBusy)return; <BR> hideJSExport(); <BR> with(divJSInput.style){ <BR> display="block"; <BR> left=(document.body.clientWidth-divJSInput.offsetWidth)/2; <BR> top=(document.body.clientHeight-divJSInput.offsetHeight)/2; <BR> } <br><br> txtJSInput.focus(); <br><br> return(false); <BR>} <br><br>function showJSExport(){ <BR> if(glbBusy)return; <BR> hideJSInput(); <BR> with(divJSExport.style){ <BR> display="block"; <BR> left=(document.body.clientWidth-divJSExport.offsetWidth)/2; <BR> top=(document.body.clientHeight-divJSExport.offsetHeight)/2; <BR> } <BR> divJSExportContent.style.display="none"; <BR> selJSExport.style.display="block"; <br><br> selJSExport.focus(); <BR> return(false); <BR>} <br><br>function hideJSInput(){ <BR> divJSInput.style.display="none"; <BR>} <br><br>function hideJSExport(){ <BR> divJSExport.style.display="none"; <BR>} <br><br>function execJSInput(){ <BR> hideJSInput(); <br><br> divJSOutput.innerHTML=""; <BR> divJSOutputLineNo.innerHTML=""; <BR> divJSOutputPlus.innerHTML=""; <br><br> glbStr=txtJSInput.innerText; // not support FF <BR> glbP=0; <BR> glbFuntionNames=new Array(); <BR> curRe=glbRe=document.createElement("div"); <br><br> divJSOutput.appendChild(glbRe); <BR> glbRe.className="codeRoot"; <br><br> while(selJSExport.options.length>0)selJSExport.options[0]=null; <br><br> showWait(startRecalcLine); <BR> core_analysis(); <BR>} <br><br>function execJSExport(){ <BR> var fns=new Array(), fcs=new Array(), str; <br><br> for(var i=0; i<selJSExport.options.length; i++){ <BR> if(selJSExport.options[i].selected){ <BR> fns.push(selJSExport.options[i].value); <BR> str=selJSExport.options[i].obj.outerHTML; <BR> try{ <BR> str+=selJSExport.options[i].obj.nextSibling.outerHTML; <BR> str+=selJSExport.options[i].obj.nextSibling.nextSibling.outerHTML; <BR> }catch(e){} <BR> fcs.push(str); <BR> } <BR> } <BR> if(fns.length==0)return; <br><br> divJSExportContent.style.display="block"; <BR> selJSExport.style.display="none"; <br><br> divJSExportContent.innerHTML=fcs.join("\r\n<br>\r\n"); <BR>} <br><br>function execJSExport_Dep(){ <BR> var fns=new Array(), fcs=new Array(), str, regFNs=new Array(), needDepthTest; <br><br> for(var i=0; i<selJSExport.options.length; i++){ <BR> if(selJSExport.options[i].selected){ <BR> fns.push(selJSExport.options[i].value); <BR> try{ <BR> str=selJSExport.options[i].obj.nextSibling.outerHTML; <BR> }catch(e){} <BR> fcs.push(str); <BR> } <BR> } <BR> if(fns.length==0)return; <br><br> divJSExportContent.style.display="none"; <BR> selJSExport.style.display="block"; <br><br> needDepthTest=false; <BR> for(var i=0;i<glbFuntionNames.length;i+=1){ <BR> if(!selJSExport.options[i].selected){ <BR> for(j=0;j<fcs.length;j++){ <BR> if(html2txt(fcs[j]).match(glbFuntionNames[i].replace(/\./g,"\\."))){ <BR> selJSExport.options[i].selected=true; <BR> needDepthTest=true; <BR> break; <BR> } <BR> } <BR> } <BR> } <BR> if(needDepthTest)execJSExport_Dep(); <BR>} <br><br><BR>function showWait(onstop){ <BR> glbBusy=true; <BR> document.body.style.cursor="wait"; <br><br> with(divWaiting.style){ <BR> display="block"; <BR> left=(document.body.clientWidth-divWaiting.offsetWidth)/2; <BR> top=(document.body.clientHeight-divWaiting.offsetHeight)/2; <BR> } <BR> spnProcess.innerHTML="0.00% ( 0 / 0 )"; <BR> divWaiting.onstop=onstop; <BR> cmdStop.focus(); <BR> return(false); <BR>} <br><br>function hideWait(){ <BR> glbBusy=false; <BR> document.body.style.cursor=""; <BR> divWaiting.style.display="none"; <BR> try{clearTimeout(glbTimer);}catch(e){} <BR> try{divWaiting.onstop();}catch(e){} <BR> return(false); <BR>} <br><br>function stopExec(){ hideWait(); } <br><br>function startRecalcLine(){ <BR> var re="", re2=""; <BR> if(glbBusy)return; <BR> glbBusy=true; <br><br> for(var i=0;i<parseInt(divJSOutput.scrollHeight/14+200);i++){ <BR> re+="<p>"+(i+1)+""; <BR> re2+="<p> "; <BR> } <br><br> divJSOutputLineNo.innerHTML=re; <BR> divJSOutputPlus.innerHTML=re2; <BR> divJSOutputPlus.buttons=new Array(); <br><br> glbP=0; <br><br> showWait(); <BR> recalcLine(); <BR> return(false); <br><br>} <br><br><BR>function recalcLine(){ <BR> var objs, j; <br><br> objs=document.getElementsByTagName("div"); <BR> for(var i=glbP;i<objs.length&&(i-glbP<30);i++){ <BR> if(objs[i].className=="indent"){ <BR> j=parseInt(objs[i].offsetTop/14)-1; <BR> divJSOutputPlus.childNodes[j].className="colsp"; <BR> divJSOutputPlus.childNodes[j].innerHTML="-"; <BR> divJSOutputPlus.childNodes[j].linkedDIV=objs[i]; <BR> divJSOutputPlus.childNodes[j].startIndex=j+1; <BR> divJSOutputPlus.childNodes[j].endIndex=j+Math.round(objs[i].offsetHeight/14); <BR> if(objs[i].innerHTML!="")divJSOutputPlus.childNodes[j].endIndex++; <BR> divJSOutputPlus.childNodes[j].switchDIV=divJSOutputPlus.childNodes[j].onclick=switchDIV; <BR> divJSOutputPlus.buttons.push(divJSOutputPlus.childNodes[j]); <BR> } <BR> } <BR> spnProcess.innerHTML=parseFloat(glbP/objs.length*100).toFixed(2)+"% ( "+glbP+" / "+objs.length+" )"; <BR> if(i<objs.length){glbP=i; glbTimer=setTimeout(recalcLine); return;} <BR> stopExec(); <BR> divJSOutput_onscroll(); <BR>} <br><br>function switchDIV(disp){ <BR> var y, obj; <BR> if((this.className=="colsp"||disp=="hide")&&disp!="show"){ <BR> this.className="colsp2"; <BR> this.innerHTML="+"; <BR> for(var i=this.startIndex;i<this.endIndex;i++){ <BR> divJSOutputLineNo.childNodes[i].style.display="none"; <BR> divJSOutputPlus.childNodes[i].style.display="none"; <BR> } <BR> this.linkedDIV.style.display="none"; <BR> }else{ <BR> this.className="colsp"; <BR> this.innerHTML="-"; <BR> this.linkedDIV.style.display="block"; <BR> for(var i=this.startIndex;i<this.endIndex;i++){ <BR> divJSOutputLineNo.childNodes[i].style.display="block"; <BR> divJSOutputPlus.childNodes[i].style.display="block"; <BR> if(divJSOutputPlus.childNodes[i].className=="colsp2"){ <BR> i=divJSOutputPlus.childNodes[i].endIndex-1; <BR> } <BR> } <BR> } <BR> divJSOutput_onscroll(); <BR>} <br><br>function collapseAll(index){ <BR> index=isNaN(parseInt(index))?0:parseInt(index); <BR> if(!divJSOutputPlus.buttons)return; <BR> if(index<0)index=0; <BR> if(index>divJSOutputPlus.buttons.length)return; <BR> for(var i=index;i<divJSOutputPlus.buttons.length&&i-index<10;i++)divJSOutputPlus.buttons[i].switchDIV("hide"); <BR> setTimeout("collapseAll("+i+")"); <BR>} <br><br>function expandAll(index){ <BR> index=isNaN(parseInt(index))?0:parseInt(index); <BR> if(!divJSOutputPlus.buttons)return; <BR> if(index<0)index=0; <BR> if(index>divJSOutputPlus.buttons.length)return; <BR> for(var i=index;i<divJSOutputPlus.buttons.length&&i-index<10;i++)divJSOutputPlus.buttons[i].switchDIV("show"); <BR> setTimeout("expandAll("+i+")"); <BR>} <br><br><BR>function core_analysis(){ <BR> var str=" ", c="", lastState="", seq, intNextQuote, intTemp, intCount, intWordStart; <BR> spnProcess.innerHTML=parseFloat(glbP/glbStr.length*100).toFixed(2)+"% ( "+glbP+" / "+glbStr.length+" )"; <BR> for(var i=glbP;i<glbStr.length;i++){ <BR> c=glbStr.charAt(i); <BR> str+=htmlEncode(c); <BR> switch(c){ <BR> case "\r": case " ": case "\t": <BR> if(lastState=="\r\n"){str=" ";break;} <BR> str=str.substring(0,str.length-htmlEncode(c).length); <BR> if(lastState=="blank")break; <BR> if(c.match(/\W/)&&glbStr.charAt(i-1).match(/\w/)){ <BR> str=str.replace(regKW,clKW).replace(regObj,clObj).replace(regMP,clMP); <BR> } <BR> str+=htmlEncode(c); <BR> lastState="blank"; <BR> break; <BR> case ";": <BR> if(str.match(/\Wfor.*?\(/i))break; <BR> // attention there's no break here <BR> case "\n": <BR> if(lastState=="\r\n"){str=" ";break;} <BR> outputLn(str); <BR> str=" "; <BR> lastState="\r\n"; <BR> if(i-glbP>200){ <BR> glbP=i+1; <BR> glbTimer=setTimeout(core_analysis); <BR> return; <BR> } <BR> break; <BR> case "\"": <BR> intNextQuote=i; <BR> while(intNextQuote!=-1&&intNextQuote<glbStr.length){ <BR> intNextQuote=glbStr.indexOf("\"",intNextQuote+1); <BR> if(intNextQuote==-1||glbStr.charAt(intNextQuote-1)!="\\")break; <BR> intCount=0; intTemp=intNextQuote; <BR> while(glbStr.charAt(--intTemp)=="\\")intCount++; <BR> if(intCount%2==0)break; <BR> } <BR> if(intNextQuote==-1)break; <BR> str+="<span class=\"quote\">"+htmlEncode(glbStr.substring(i+1,intNextQuote))+"<\/span>\""; <BR> i=intNextQuote; <BR> lastState=""; <BR> break; <BR> case "\'": <BR> intNextQuote=i; <BR> while(intNextQuote!=-1&&intNextQuote<glbStr.length){ <BR> intNextQuote=glbStr.indexOf("\'",intNextQuote+1); <BR> if(intNextQuote==-1||glbStr.charAt(intNextQuote-1)!="\\")break; <BR> intCount=0; intTemp=intNextQuote; <BR> while(glbStr.charAt(--intTemp)=="\\")intCount++; <BR> if(intCount%2==0)break; <BR> } <BR> if(intNextQuote==-1)break; <BR> str+="<span class=\"quote\">"+htmlEncode(glbStr.substring(i+1,intNextQuote))+"<\/span>\'"; <BR> i=intNextQuote; <BR> lastState=""; <BR> break; <BR> case "\/": <BR> if(glbStr.charAt(i+1)=="\/"){ <BR> intNextQuote=i; <BR> intNextQuote=glbStr.indexOf("\r\n",intNextQuote+1); <BR> if(intNextQuote==-1)intNextQuote=glbStr.length; <BR> str=str.substring(0,str.length-1); <BR> str+="<span class=\"comments\">\/"+htmlEncode(glbStr.substring(i+1,intNextQuote)) <BR>+"<\/span>"; <BR> i=intNextQuote; <BR> }else if(glbStr.charAt(i+1)=="*"){ <BR> intNextQuote=i; <BR> intNextQuote=glbStr.indexOf("*\/",intNextQuote+1); <BR> if(intNextQuote==-1)return; <BR> str=str.substring(0,str.length-1); <BR> str+="<span class=\"comments\">\/"+htmlEncode(glbStr.substring(i+1,intNextQuote)) <BR>+"*\/<\/span>"; <BR> i=intNextQuote+1; <BR> }else if(str.match(/[=(][ \t]*\//)){ <BR> intNextQuote=i; <BR> while(intNextQuote!=-1&&intNextQuote<glbStr.length){ <BR> intNextQuote=glbStr.indexOf("\/",intNextQuote+1); <BR> if(intNextQuote==-1||glbStr.charAt(intNextQuote-1)!="\\")break; <BR> intCount=0; intTemp=intNextQuote; <BR> while(glbStr.charAt(--intTemp)=="\\")intCount++; <BR> if(intCount%2==0)break; <BR> } <BR> if(intNextQuote==-1)break; <BR> str+="<span class=\"regexp\">"+htmlEncode(glbStr.substring(i+1,intNextQuote)) <BR>+"<\/span>\/"; <BR> i=intNextQuote; <BR> lastState=""; <BR> } <BR> lastState=""; <BR> break; <BR> case "{": <BR> outputLn(str); <BR> str=" "; <BR> seq=document.createElement("div"); <BR> seq.className="indent"; <BR> curRe.appendChild(seq); <BR> curRe=seq; <BR> lastState="\r\n"; <BR> if(i-glbP>200){ <BR> glbP=i+1; <BR> glbTimer=setTimeout(core_analysis); <BR> return; <BR> } <BR> break; <BR> case "}": <BR> outputLn(str.substring(0,str.length-1)); <BR> str="} "; <BR> lastState=""; <BR> curRe=curRe.parentNode; <BR> break; <BR> default: <BR> if(c.match(/\w/)&&glbStr.charAt(i-1).match(/\W/)){intWordStart=i;} <BR> if(c.match(/\W/)&&glbStr.charAt(i-1).match(/\w/)){ <BR> str=str.substring(0,str.length-htmlEncode(c).length); <BR> str=str.replace(regKW,clKW).replace(regObj,clObj).replace(regMP,clMP)+htmlEncode(c); <BR> } <BR> lastState=""; <BR> break; <BR> } <BR> } <br><br> if(i==glbStr.length){ <BR> if(str!=""){ outputLn(str); str=" "; } <BR> stopExec(); <BR> } <br><br>} <br><br>function outputLn(theStr){ <BR> var seq, txt, fn; <BR> if(html2txt(theStr).match(/^[ \t\r\n]*$/))return; <BR> seq=document.createElement("p"); <BR> seq.innerHTML=theStr; <BR> curRe.appendChild(seq); <br><br> txt=html2txt(theStr); <BR> if(!txt)return; <BR> fn=txt.match(/function[ \t\r\n]+([\.\w]+?)[ \t\r\n]*\(.*?\)[ \t\r\n]*\{/); <BR> if(fn){ <BR> glbFuntionNames.push(fn[1]); <BR> selJSExport.options[selJSExport.options.length]=new Option(fn[0]+"}",fn[1]); <BR> selJSExport.options[selJSExport.options.length-1].obj=seq; <BR> } <BR> fn=txt.match(/([\.\w]+?)[ \t\r\n]*=[ \t\r\n]*function\W*\(.*?\)[ \t\r\n]*\{/); <BR> if(fn){ <BR> glbFuntionNames.push(fn[1]); <BR> selJSExport.options[selJSExport.options.length]=new Option(fn[0]+"}",fn[1]); <BR> selJSExport.options[selJSExport.options.length-1].obj=seq; <BR> } <BR>} <br><br>function clKW(str){ return(str.charAt(0)+"<span class=\"keyWord\">"+str.substring(1)+""); } <br><br>function clObj(str){ return(str.charAt(0)+"<span class=\"object\">"+str.substring(1)+""); } <br><br>function clMP(str){ return(str.charAt(0)+"<span class=\"method_property\">"+str.substring(1)+""); } <br><br>function clOP(str){ return(str.charAt(0)+"<span class=\"operator\">"+str.substring(1)+""); } <br><br><BR>//------------------ <BR>// global scripts <BR>//------------------ <br><br>function maximizeWindow(){ <BR> window.moveTo(0,0); <BR> window.resizeTo(screen.availWidth,screen.availHeight); <BR>} <br><br>function htmlEncode(strS){ <BR> return(strS.replace(/&/g,"&").replace(/,"<").replace(/>/g,">").replace(/ /g," ").replace(/ <BR>\r\n/g,"<br\/>")); <BR>} <br><br>function html2txt(strS){ <BR> return(strS.replace(/<.+?>/g,"").replace(/,"<").replace(/>/g,">").replace(/ /g," ").replace(/<br\/? <BR>>/g,"\r\n").replace(/&/g,"&")); <BR>} <br><br></script>




Input JS
Collapse All
Expand All
Export JS



    
Please Input the JS:

    
声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
Java vs JavaScript:开发人员的详细比较Java vs JavaScript:开发人员的详细比较May 16, 2025 am 12:01 AM

javaandjavascriptaredistinctlanguages:javaisusedforenterpriseandmobileapps,while javascriptifforInteractiveWebpages.1)JavaisComcompoppored,statieldinglationallyTypted,statilly tater astrunsonjvm.2)

JavaScript数据类型:浏览器和nodejs之间是否有区别?JavaScript数据类型:浏览器和nodejs之间是否有区别?May 14, 2025 am 12:15 AM

JavaScript核心数据类型在浏览器和Node.js中一致,但处理方式和额外类型有所不同。1)全局对象在浏览器中为window,在Node.js中为global。2)Node.js独有Buffer对象,用于处理二进制数据。3)性能和时间处理在两者间也有差异,需根据环境调整代码。

JavaScript评论:使用//和 / * * / * / * /JavaScript评论:使用//和 / * * / * / * /May 13, 2025 pm 03:49 PM

JavaScriptusestwotypesofcomments:single-line(//)andmulti-line(//).1)Use//forquicknotesorsingle-lineexplanations.2)Use//forlongerexplanationsorcommentingoutblocksofcode.Commentsshouldexplainthe'why',notthe'what',andbeplacedabovetherelevantcodeforclari

Python vs. JavaScript:开发人员的比较分析Python vs. JavaScript:开发人员的比较分析May 09, 2025 am 12:22 AM

Python和JavaScript的主要区别在于类型系统和应用场景。1.Python使用动态类型,适合科学计算和数据分析。2.JavaScript采用弱类型,广泛用于前端和全栈开发。两者在异步编程和性能优化上各有优势,选择时应根据项目需求决定。

Python vs. JavaScript:选择合适的工具Python vs. JavaScript:选择合适的工具May 08, 2025 am 12:10 AM

选择Python还是JavaScript取决于项目类型:1)数据科学和自动化任务选择Python;2)前端和全栈开发选择JavaScript。Python因其在数据处理和自动化方面的强大库而备受青睐,而JavaScript则因其在网页交互和全栈开发中的优势而不可或缺。

Python和JavaScript:了解每个的优势Python和JavaScript:了解每个的优势May 06, 2025 am 12:15 AM

Python和JavaScript各有优势,选择取决于项目需求和个人偏好。1.Python易学,语法简洁,适用于数据科学和后端开发,但执行速度较慢。2.JavaScript在前端开发中无处不在,异步编程能力强,Node.js使其适用于全栈开发,但语法可能复杂且易出错。

JavaScript的核心:它是在C还是C上构建的?JavaScript的核心:它是在C还是C上构建的?May 05, 2025 am 12:07 AM

javascriptisnotbuiltoncorc; saninterpretedlanguagethatrunsonenginesoftenwritteninc.1)javascriptwasdesignedAsalightweight,解释edganguageforwebbrowsers.2)Enginesevolvedfromsimpleterterterpretpreterterterpretertestojitcompilerers,典型地提示。

JavaScript应用程序:从前端到后端JavaScript应用程序:从前端到后端May 04, 2025 am 12:12 AM

JavaScript可用于前端和后端开发。前端通过DOM操作增强用户体验,后端通过Node.js处理服务器任务。1.前端示例:改变网页文本内容。2.后端示例:创建Node.js服务器。

See all articles

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热工具

SecLists

SecLists

SecLists是最终安全测试人员的伙伴。它是一个包含各种类型列表的集合,这些列表在安全评估过程中经常使用,都在一个地方。SecLists通过方便地提供安全测试人员可能需要的所有列表,帮助提高安全测试的效率和生产力。列表类型包括用户名、密码、URL、模糊测试有效载荷、敏感数据模式、Web shell等等。测试人员只需将此存储库拉到新的测试机上,他就可以访问到所需的每种类型的列表。

PhpStorm Mac 版本

PhpStorm Mac 版本

最新(2018.2.1 )专业的PHP集成开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

螳螂BT

螳螂BT

Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。