欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JavaScript版代碼高亮

 更新時(shí)間:2006年06月26日 00:00:00   作者:  

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JavaScript版代碼高亮</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class="menu_head">JavaScript版代碼高亮顯示</div>
<div class="content">
<script language="JavaScript" type="text/javascript">
/**
** ======================================================================================
** 類名:CLASS_HIGHLIGHT
** 功能:語(yǔ)法高亮
** 示例:
 var xx  = new CLASS_HIGHLIGHT(code,syntax);
 document.getElementById("display").innerHTML = xx.highlight();
** ======================================================================================
**/

function CLASS_HIGHLIGHT(code,syntax){
 //哈希表類
 function Hashtable(){
  this._hash = new Object();
  this.add = function(key,value){
   if(typeof(key)!="undefined"){
    if(this.contains(key)==false){
     this._hash[key]=typeof(value)=="undefined"?null:value;
     return true;
    } else {
     return false;
    }
   } else {
    return false;
   }
  }
  this.remove  = function(key){delete this._hash[key];}
  this.count  = function(){var i=0;for(var k in this._hash){i++;} return i;}
  this.items  = function(key){return this._hash[key];}
  this.contains = function(key){return typeof(this._hash[key])!="undefined";}
  this.clear  = function(){for(var k in this._hash){delete this._hash[k];}}
 }

 this._caseSensitive = true;

 //字符串轉(zhuǎn)換為哈希表
 this.str2hashtable = function(key,cs){
  var _key = key.split(/,/g);
  var _hash = new Hashtable();
  var _cs  = true;

  if(typeof(cs)=="undefined"||cs==null){
   _cs = this._caseSensitive;
  } else {
   _cs = cs;
  }

  for(var i in _key){
   if(_cs){
    _hash.add(_key[i]);
   } else {
    _hash.add((_key[i]+"").toLowerCase());
   }
  }
  return _hash;
 }

 //獲得需要轉(zhuǎn)換的代碼
 this._codetxt = code;
 if(typeof(syntax)=="undefined"){
  syntax = "";
 }

 switch(syntax.toLowerCase()){
  case "sql":
   //是否大小寫(xiě)敏感
   this._caseSensitive = false;
   //得到關(guān)鍵字哈希表
   this._keywords  = this.str2hashtable("COMMIT,DELETE,INSERT,LOCK,ROLLBACK,SELECT,TRANSACTION,READ,ONLY,WRITE,USE,ROLLBACK,SEGMENT,ROLE,EXCEPT,NONE,UPDATE,DUAL,WORK,COMMENT,FORCE,FROM,WHERE,INTO,VALUES,ROW,SHARE,MODE,EXCLUSIVE,UPDATE,ROW,NOWAIT,TO,SAVEPOINT,UNION,UNION,ALL,INTERSECT,MINUS,START,WITH,CONNECT,BY,GROUP,HAVING,ORDER,UPDATE,NOWAIT,IDENTIFIED,SET,DROP,PACKAGE,CREATE,REPLACE,PROCEDURE,FUNCTION,TABLE,RETURN,AS,BEGIN,DECLARE,END,IF,THEN,ELSIF,ELSE,WHILE,CURSOR,EXCEPTION,WHEN,OTHERS,NO_DATA_FOUND,TOO_MANY_ROWS,CURSOR_ALREADY_OPENED,FOR,LOOP,IN,OUT,TYPE,OF,INDEX,BINARY_INTEGER,RAISE,ROWTYPE,VARCHAR2,NUMBER,LONG,DATE,RAW,LONG RAW,CHAR,INTEGER,MLSLABEL,CURRENT,OF,DEFAULT,CURRVAL,NEXTVAL,LEVEL,ROWID,ROWNUM,DISTINCT,ALL,LIKE,IS,NOT,NULL,BETWEEN,ANY,AND,OR,EXISTS,ASC,DESC,ABS,CEIL,COS,COSH,EXP,FLOOR,LN,LOG,MOD,POWER,ROUND,SIGN,SIN,SINH,SQRT,TAN,TANH,TRUNC,CHR,CONCAT,INITCAP,LOWER,LPAD,LTRIM,NLS_INITCAP,NLS_LOWER,NLS_UPPER,REPLACE,RPAD,RTRIM,SOUNDEX,SUBSTR,SUBSTRB,TRANSLATE,UPPER,ASCII,INSTR,INSTRB,LENGTH,LENGTHB,NLSSORT,ADD_MONTHS,LAST_DAY,MONTHS_BETWEEN,NEW_TIME,NEXT_DAY,ROUND,SYSDATE,TRUNC,CHARTOROWID,CONVERT,HEXTORAW,RAWTOHEX,ROWIDTOCHAR,TO_CHAR,TO_DATE,TO_LABEL,TO_MULTI_BYTE,TO_NUMBER,TO_SINGLE_BYTE,DUMP,GREATEST,GREATEST_LB,LEAST,LEAST_UB,NVL,UID,USER,USERENV,VSIZE,AVG,COUNT,GLB,LUB,MAX,MIN,STDDEV,SUM,VARIANCE");
   //得到內(nèi)建對(duì)象哈希表
   this._commonObjects = this.str2hashtable("");
   //標(biāo)記
   this._tags   = this.str2hashtable("",false);
   //得到分割字符
   this._wordDelimiters= "  ,.?!;:\\/<>(){}[]\"'\r\n\t=+-|*%@#$^&";
   //引用字符
   this._quotation  = this.str2hashtable("'");
   //行注釋字符
   this._lineComment = "--";
   //轉(zhuǎn)義字符
   this._escape  = "";
   //多行引用開(kāi)始
   this._commentOn  = "/*";
   //多行引用結(jié)束
   this._commentOff = "*/";
   //忽略詞
   this._ignore  = "";
   //是否處理標(biāo)記
   this._dealTag  = false;
   break;
  case "c#":
   //是否大小寫(xiě)敏感
   this._caseSensitive = true;
   //得到關(guān)鍵字哈希表
   this._keywords  = this.str2hashtable("abstract,as,base,bool,break,byte,case,catch,char,checked,class,const,continue,decimal,default,delegate,do,double,else,enum,event,explicit,extern,false,finally,fixed,float,for,foreach,get,goto,if,implicit,in,int,interface,internal,is,lock,long,namespace,new,null,object,operator,out,override,params,private,protected,public,readonly,ref,return,sbyte,sealed,short,sizeof,stackalloc,static,set,string,struct,switch,this,throw,true,try,typeof,uint,ulong,unchecked,unsafe,ushort,using,value,virtual,void,volatile,while");
   //得到內(nèi)建對(duì)象哈希表
   this._commonObjects = this.str2hashtable("String,Boolean,DateTime,Int32,Int64,Exception,DataTable,DataReader");
   //標(biāo)記
   this._tags   = this.str2hashtable("",false);
   //得到分割字符
   this._wordDelimiters= "  ,.?!;:\\/<>(){}[]\"'\r\n\t=+-|*%@#$^&";
   //引用字符
   this._quotation  = this.str2hashtable("\"");
   //行注釋字符
   this._lineComment = "http://";
   //轉(zhuǎn)義字符
   this._escape  = "\\";
   //多行引用開(kāi)始
   this._commentOn  = "/*";
   //多行引用結(jié)束
   this._commentOff = "*/";
   //忽略詞
   this._ignore  = "";
   //是否處理標(biāo)記
   this._dealTag  = false;
   break;
  case "java":
   //是否大小寫(xiě)敏感
   this._caseSensitive = true;
   //得到關(guān)鍵字哈希表
   this._keywords  = this.str2hashtable("abstract,boolean,break,byte,case,catch,char,class,const,continue,default,do,double,else,extends,final,finally,float,for,goto,if,implements,import,instanceof,int,interface,long,native,new,package,private,protected,public,return,short,static,strictfp,super,switch,synchronized,this,throw,throws,transient,try,void,volatile,while");
   //得到內(nèi)建對(duì)象哈希表
   this._commonObjects = this.str2hashtable("String,Boolean,DateTime,Int32,Int64,Exception,DataTable,DataReader");
   //標(biāo)記
   this._tags   = this.str2hashtable("",false);
   //得到分割字符
   this._wordDelimiters= "  ,.?!;:\\/<>(){}[]\"'\r\n\t=+-|*%@#$^&";
   //引用字符
   this._quotation  = this.str2hashtable("\"");
   //行注釋字符
   this._lineComment = "http://";
   //轉(zhuǎn)義字符
   this._escape  = "\\";
   //多行引用開(kāi)始
   this._commentOn  = "/*";
   //多行引用結(jié)束
   this._commentOff = "*/";
   //忽略詞
   this._ignore  = "";
   //是否處理標(biāo)記
   this._dealTag  = false;
   break;
  case "vbs":
  case "vb":
   //是否大小寫(xiě)敏感
   this._caseSensitive = false;
   //得到關(guān)鍵字哈希表
   this._keywords  = this.str2hashtable("And,ByRef,ByVal,Call,Case,Class,Const,Dim,Do,Each,Else,ElseIf,Empty,End,Eqv,Erase,Error,Exit,Explicit,False,For,Function,Get,If,Imp,In,Is,Let,Loop,Mod,Next,Not,Nothing,Null,On,Option,Or,Private,Property,Public,Randomize,ReDim,Resume,Select,Set,Step,Sub,Then,To,True,Until,Wend,While,Xor,Anchor,Array,Asc,Atn,CBool,CByte,CCur,CDate,CDbl,Chr,CInt,CLng,Cos,CreateObject,CSng,CStr,Date,DateAdd,DateDiff,DatePart,DateSerial,DateValue,Day,Dictionary,Document,Element,Err,Exp,FileSystemObject,Filter,Fix,Int,Form,FormatCurrency,FormatDateTime,FormatNumber,FormatPercent,GetObject,Hex,Hour,InputBox,InStr,InstrRev,IsArray,IsDate,IsEmpty,IsNull,IsNumeric,IsObject,Join,LBound,LCase,Left,Len,Link,LoadPicture,Location,Log,LTrim,RTrim,Trim,Mid,Minute,Month,MonthName,MsgBox,Navigator,Now,Oct,Replace,Right,Rnd,Round,ScriptEngine,ScriptEngineBuildVersion,ScriptEngineMajorVersion,ScriptEngineMinorVersion,Second,Sgn,Sin,Space,Split,Sqr,StrComp,String,StrReverse,Tan,Time,TextStream,TimeSerial,TimeValue,TypeName,UBound,UCase,VarType,Weekday,WeekDayName,Year");
   //得到內(nèi)建對(duì)象哈希表
   this._commonObjects = this.str2hashtable("String,Number,Boolean,Date,Integert,Long,Double,Single");
   //標(biāo)記
   this._tags   = this.str2hashtable("",false);
   //得到分割字符
   this._wordDelimiters= "  ,.?!;:\\/<>(){}[]\"'\r\n\t=+-|*%@#$^&";
   //引用字符
   this._quotation  = this.str2hashtable("\"");
   //行注釋字符
   this._lineComment = "'";
   //轉(zhuǎn)義字符
   this._escape  = "";
   //多行引用開(kāi)始
   this._commentOn  = "";
   //多行引用結(jié)束
   this._commentOff = "";
   //忽略詞
   this._ignore  = "<!--";
   //是否處理標(biāo)記
   this._dealTag  = false;
   break;
  case "js":
   //是否大小寫(xiě)敏感
   this._caseSensitive = true;
   //得到關(guān)鍵字哈希表
   this._keywords  = this.str2hashtable("function,void,this,boolean,while,if,return,new,true,false,try,catch,throw,null,else,int,long,do,var");
   //得到內(nèi)建對(duì)象哈希表
   this._commonObjects = this.str2hashtable("String,Number,Boolean,RegExp,Error,Math,Date");
   //標(biāo)記
   this._tags   = this.str2hashtable("",false);
   //得到分割字符
   this._wordDelimiters= "  ,.?!;:\\/<>(){}[]\"'\r\n\t=+-|*%@#$^&";
   //引用字符
   this._quotation  = this.str2hashtable("\",'");
   //行注釋字符
   this._lineComment = "http://";
   //轉(zhuǎn)義字符
   this._escape  = "\\";
   //多行引用開(kāi)始
   this._commentOn  = "/*";
   //多行引用結(jié)束
   this._commentOff = "*/";
   //忽略詞
   this._ignore  = "<!--";
   break;
  case "html":
   //是否大小寫(xiě)敏感
   this._caseSensitive = true;
   //得到關(guān)鍵字哈希表
   this._keywords  = this.str2hashtable("function,void,this,boolean,while,if,return,new,true,false,try,catch,throw,null,else,int,long,do,var");
   //得到內(nèi)建對(duì)象哈希表
   this._commonObjects = this.str2hashtable("String,Number,Boolean,RegExp,Error,Math,Date");
   //標(biāo)記
   this._tags   = this.str2hashtable("html,head,body,title,style,script,language,input,select,div,span,button,img,iframe,frame,frameset,table,tr,td,caption,form,font,meta,textarea",false);
   //得到分割字符
   this._wordDelimiters= "  ,.?!;:\\/<>(){}[]\"'\r\n\t=+-|*%@#$^&";
   //引用字符
   this._quotation  = this.str2hashtable("\",'");
   //行注釋字符
   this._lineComment = "http://";
   //轉(zhuǎn)義字符
   this._escape  = "\\";
   //多行引用開(kāi)始
   this._commentOn  = "/*";
   //多行引用結(jié)束
   this._commentOff = "*/";
   //忽略詞
   this._ignore  = "<!--";
   //是否處理標(biāo)記
   this._dealTag  = true;
   break;
  case "xml":
  default:
   //是否大小寫(xiě)敏感
   this._caseSensitive = true;
   //得到關(guān)鍵字哈希表
   this._keywords  = this.str2hashtable("!DOCTYPE,?xml,script,version,encoding");
   //得到內(nèi)建對(duì)象哈希表
   this._commonObjects = this.str2hashtable("");
   //標(biāo)記
   this._tags   = this.str2hashtable("",false);
   //得到分割字符
   this._wordDelimiters= "  ,.;:\\/<>(){}[]\"'\r\n\t=+-|*%@#$^&";
   //引用字符
   this._quotation  = this.str2hashtable("\",'");
   //行注釋字符
   this._lineComment = "";
   //轉(zhuǎn)義字符
   this._escape  = "\\";
   //多行引用開(kāi)始
   this._commentOn  = "<!--";
   //多行引用結(jié)束
   this._commentOff = "-->";
   //忽略詞
   this._ignore  = "<!--";
   //是否處理標(biāo)記
   this._dealTag  = true;
   break;
 }

 this.highlight = function() {
  var codeArr = new Array();
  var word_index = 0;
  var htmlTxt = new Array();

  //得到分割字符數(shù)組(分詞)
  for (var i = 0; i < this._codetxt.length; i++) {
   if (this._wordDelimiters.indexOf(this._codetxt.charAt(i)) == -1) {  //找不到關(guān)鍵字
    if (codeArr[word_index] == null || typeof(codeArr[word_index]) == 'undefined') {
     codeArr[word_index] = "";
    }
    codeArr[word_index] += this._codetxt.charAt(i);
   } else {
    if (typeof(codeArr[word_index]) != 'undefined' && codeArr[word_index].length > 0)
     word_index++;
    codeArr[word_index++] = this._codetxt.charAt(i);
   }
  }

  var quote_opened    = false; //引用標(biāo)記
  var slash_star_comment_opened = false; //多行注釋標(biāo)記
  var slash_slash_comment_opened = false; //單行注釋標(biāo)記
  var line_num     = 1;  //行號(hào)
  var quote_char     = "";  //引用標(biāo)記類型
  var tag_opened     = false; //標(biāo)記開(kāi)始

  htmlTxt[htmlTxt.length] = ("<div style='font-family: Courier New;font-size:12px;overflow:auto;margin:1px;padding:6px;color:#333333'>");

  //按分割字,分塊顯示
  for (var i=0; i <=word_index; i++){

   //處理空行(由于轉(zhuǎn)義帶來(lái))
   if(typeof(codeArr[i])=="undefined"||codeArr[i].length==0){
    continue;
   }
   //處理空格
   if (codeArr[i] == " "){
    htmlTxt[htmlTxt.length] = ("&nbsp;");
   //處理關(guān)鍵字
   } else if (!slash_slash_comment_opened&&!slash_star_comment_opened && !quote_opened && this.isKeyword(codeArr[i])){
    htmlTxt[htmlTxt.length] = ("<span style='color:#0000FF;'>" + codeArr[i] + "</span>");
   //處理普通對(duì)象
   } else if (!slash_slash_comment_opened&&!slash_star_comment_opened && !quote_opened && this.isCommonObject(codeArr[i])){
    htmlTxt[htmlTxt.length] = ("<span style='color:#808000;'>" + codeArr[i] + "</span>");
   //處理標(biāo)記
   } else if (!slash_slash_comment_opened&&!slash_star_comment_opened && !quote_opened && tag_opened && this.isTag(codeArr[i])){
    htmlTxt[htmlTxt.length] = ("<span style='color:#0000FF;'>" + codeArr[i] + "</span>");
   //處理?yè)Q行
   } else if (codeArr[i] == "\r"){
    if (slash_slash_comment_opened){
     htmlTxt[htmlTxt.length] = ("</span>");
     slash_slash_comment_opened = false;
    }
    htmlTxt[htmlTxt.length] = ("<br/>");
    line_num++;
   //處理雙引號(hào)(引號(hào)前不能為轉(zhuǎn)義字符)
   } else if (this._quotation.contains(codeArr[i])&&!slash_star_comment_opened&&!slash_slash_comment_opened){
    if (quote_opened){
     //是相應(yīng)的引號(hào)
     if (quote_char==codeArr[i]){
      if(tag_opened){
       htmlTxt[htmlTxt.length] = (codeArr[i]+"</span><span style='color:#808000;'>");
      } else {
       htmlTxt[htmlTxt.length] = (codeArr[i]+"</span>");
      }
      quote_opened = false;
      quote_char  = "";
     } else {
      htmlTxt[htmlTxt.length] = codeArr[i].replace(/\</g,"&lt;");
     }
    } else {
     if (tag_opened){
      htmlTxt[htmlTxt.length] =  ("</span><span style='color:#FF00FF;'>"+codeArr[i]);
     } else {
      htmlTxt[htmlTxt.length] =  ("<span style='color:#FF00FF;'>"+codeArr[i]);
     }
     quote_opened = true;
     quote_char  = codeArr[i];
    }
   //處理轉(zhuǎn)義字符
   } else if(codeArr[i] == this._escape){
    htmlTxt[htmlTxt.length] = (codeArr[i]);
    if (i<word_index){
     if (codeArr[i+1].charCodeAt(0)>=32&&codeArr[i+1].charCodeAt(0)<=127){
      htmlTxt[htmlTxt.length] = codeArr[i+1].substr(0,1);
      codeArr[i+1] = codeArr[i+1].substr(1);
     }
    }
   //處理Tab
   } else if (codeArr[i] == "\t") {
    htmlTxt[htmlTxt.length] = ("&nbsp;&nbsp;");
   //處理多行注釋的開(kāi)始
   } else if (this.isStartWith(this._commentOn,codeArr,i)&&!slash_slash_comment_opened && !slash_star_comment_opened&&!quote_opened){
    slash_star_comment_opened = true;
    htmlTxt[htmlTxt.length] =  ("<span style='color:#008000;'>" + this._commentOn.replace(/\</g,"&lt"));
    i = i + this._commentOn.length-1;
   //處理單行注釋
   } else if (this.isStartWith(this._lineComment,codeArr,i)&&!slash_slash_comment_opened && !slash_star_comment_opened&&!quote_opened){
    slash_slash_comment_opened = true;
    htmlTxt[htmlTxt.length] =  ("<span style='color:#008000;'>" + this._lineComment);
    i = i + this._lineComment.length-1;
   //處理忽略詞
   } else if (this.isStartWith(this._ignore,codeArr,i)&&!slash_slash_comment_opened && !slash_star_comment_opened&&!quote_opened){
    slash_slash_comment_opened = true;
    htmlTxt[htmlTxt.length] =  ("<span style='color:#008000;'>" + this._ignore.replace(/\</g,"&lt"));
    i = i + this._ignore.length-1;
   //處理多行注釋結(jié)束
   } else if (this.isStartWith(this._commentOff,codeArr,i)&&!quote_opened&&!slash_slash_comment_opened){
    if (slash_star_comment_opened) {
     slash_star_comment_opened = false;
     htmlTxt[htmlTxt.length] =  (this._commentOff +"</span>");
     i = i + this._commentOff.length-1;
    }
   //處理左標(biāo)記
   } else if (this._dealTag&&!slash_slash_comment_opened && !slash_star_comment_opened&&!quote_opened&&codeArr[i] == "<") {
    htmlTxt[htmlTxt.length] = "&lt;<span style='color:#808000;'>";
    tag_opened = true;
   //處理右標(biāo)記
   } else if (this._dealTag&&tag_opened&&codeArr[i] == ">") {
    htmlTxt[htmlTxt.length] = "</span>&gt;";
    tag_opened = false;
   //處理HTML轉(zhuǎn)義符號(hào)
   } else if (codeArr[i] == "&") {
    htmlTxt[htmlTxt.length] = "&amp;";
   } else {
    htmlTxt[htmlTxt.length] = codeArr[i].replace(/\</g,"&lt;");
   }
  }
  htmlTxt[htmlTxt.length] = ("</div>");

  return htmlTxt.join("");
 }

 this.isStartWith = function(str,code,index){
  if(typeof(str)!="undefined"&&str.length>0){
   for(var i=0;i<str.length;i++){
    if(this._caseSensitive){
     if(str.charAt(i)!=code[index+i]||(index+i>=code.length)){
      return false;
     }
    } else {
     if(str.charAt(i).toLowerCase()!=code[index+i].toLowerCase()||(index+i>=code.length)){
      return false;
     }
    }
   }
   return true;
  } else {
   return false;
  }
 }

 this.isKeyword = function(val){
  return this._keywords.contains(this._caseSensitive?val:val.toLowerCase());
 }

 this.isCommonObject = function(val){
  return this._commonObjects.contains(this._caseSensitive?val:val.toLowerCase());
 }

 this.isTag = function(val){
  return this._tags.contains(val.toLowerCase());
 }

}

function doHighlight(o, syntax){
 var htmltxt = "";

 if(o == null){
  alert("domNode is null!");
  return;
 }

 var _codetxt = "";

 if(typeof(o)=="object"){
  switch(o.tagName){
   case "TEXTAREA":
   case "INPUT":
    _codetxt = o.value;
    break;
   case "DIV":
   case "SPAN":
    _codetxt = o.innerText;
    break;
   default:
    _codetxt = o.innerHTML;
    break;
  }
 }else{
  _codetxt = o;
 }

 var _syn = new CLASS_HIGHLIGHT(_codetxt,syntax);

 htmltxt = _syn.highlight();

 return  htmltxt;
}
</script>

<script language="JavaScript" type="text/javascript">
function plaster(){
 document.form1.m.focus()
 document.execCommand("Paste")
}

function goit(stx){
 var code = document.getElementById("m").innerText;
 var xx = new CLASS_HIGHLIGHT(code,stx);
 document.getElementById("highlight").innerHTML = xx.highlight();
}
</script>

<form method="post" name="form1">
<div align="center"><textarea rows="18" name="S1" style="width:99%" id="m"></textarea></div>
<input type="button" value="HTML" onclick="return goit('html')" />
<input type="button" value="VB/VBScript" onclick="return goit('vb')" />
<input type="button" value="JavaScript" onclick="return goit('js')" />
<input type="button" value="C#" onclick="return goit('c#')" />
<input type="button" value="SQL" onclick="return goit('sql')" />
<input type="button" value="XML" onclick="return goit('xml')" />
<input type="button" value="Java" onclick="return goit('java')" />
&nbsp;&nbsp;<input type="button" value="粘貼" onclick="plaster()" />
<input type="reset" value="清空內(nèi)容" />
</form>
<div align="center">

</div>
<div id="highlight" align="left" style="width:98%;overflow:auto;word-wrap:word-break;word-break:break-all;"><div>
</div>
</body>
</html>

相關(guān)文章

  • 微信小程序 wx.request(OBJECT)發(fā)起請(qǐng)求詳解

    微信小程序 wx.request(OBJECT)發(fā)起請(qǐng)求詳解

    這篇文章主要介紹了微信小程序 wx.request(OBJECT)發(fā)起請(qǐng)求詳解的相關(guān)資料,需要的朋友可以參考下
    2016-10-10
  • 徒手實(shí)現(xiàn)關(guān)于JavaScript的24+數(shù)組方法

    徒手實(shí)現(xiàn)關(guān)于JavaScript的24+數(shù)組方法

    數(shù)組是我們?nèi)粘9ぷ髦杏玫淖铑l繁的一類數(shù)據(jù)結(jié)構(gòu),能幫助我們解決許多問(wèn)題,而其本身也包含接近33個(gè)之多的方法,做了一個(gè)腦圖分類如下,熟練使用數(shù)組的你,是否想知道他們內(nèi)部的實(shí)現(xiàn)原理呢?接下來(lái)小編就帶大家進(jìn)入主題,希望能幫助到你
    2021-09-09
  • JavaScript實(shí)現(xiàn)一鍵復(fù)制內(nèi)容剪貼板

    JavaScript實(shí)現(xiàn)一鍵復(fù)制內(nèi)容剪貼板

    這篇文章主要為大家介紹了JavaScript實(shí)現(xiàn)一鍵復(fù)制內(nèi)容,document.execCommand原生JS設(shè)置剪貼板的實(shí)現(xiàn)示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-07-07
  • 些很實(shí)用且必用的小腳本代碼

    些很實(shí)用且必用的小腳本代碼

    些很實(shí)用且必用的小腳本代碼...
    2006-06-06
  • 微信小程序 聊天室簡(jiǎn)單實(shí)現(xiàn)

    微信小程序 聊天室簡(jiǎn)單實(shí)現(xiàn)

    這篇文章主要介紹了微信小程序 聊天室簡(jiǎn)單實(shí)現(xiàn)的相關(guān)資料,需要的朋友可以參考下
    2017-04-04
  • JavaScript的function函數(shù)詳細(xì)介紹

    JavaScript的function函數(shù)詳細(xì)介紹

    這篇文章主要介紹了JavaScript的function函數(shù)詳細(xì),而我們的JavaScript腳本語(yǔ)言比較特殊,相對(duì)于C語(yǔ)言,它的參數(shù)是不需要數(shù)據(jù)類型加持的。返回值return,我就不過(guò)多描述,他是和 C語(yǔ)言通的,如果沒(méi)寫(xiě)他就會(huì)自動(dòng)返回undefined,下面一起來(lái)看看文章內(nèi)容,需要的朋友可以參考一下
    2021-11-11
  • lodash內(nèi)部方法getFuncName及setToString剖析詳解

    lodash內(nèi)部方法getFuncName及setToString剖析詳解

    本篇章我們主要是通過(guò)了解lodash里的兩個(gè)內(nèi)部方法getFuncName方法和setToString方法,在實(shí)際開(kāi)發(fā)中我們也可以借鑒方法的實(shí)現(xiàn)思路,在需要的時(shí)候簡(jiǎn)單封裝一下,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-09-09
  • JS代碼檢查工具ESLint介紹與使用方法

    JS代碼檢查工具ESLint介紹與使用方法

    ESLint是一個(gè)JavaScript代碼靜態(tài)檢查工具,可以檢查JavaScript的語(yǔ)法錯(cuò)誤,提示潛在的bug,本文將詳細(xì)介紹ESLint的使用方法
    2020-02-02
  • 微信小程序 表單Form實(shí)例詳解(附源碼)

    微信小程序 表單Form實(shí)例詳解(附源碼)

    這篇文章主要介紹了微信小程序 表單Form實(shí)例詳解的相關(guān)資料,這里對(duì)form 表單進(jìn)行了詳細(xì)介紹,并附實(shí)例代碼,需要的朋友可以參考下
    2016-12-12
  • 5種方法告訴你如何使JavaScript 代碼庫(kù)更干凈

    5種方法告訴你如何使JavaScript 代碼庫(kù)更干凈

    J avaScript無(wú)處不在,從PC端到移動(dòng)設(shè)備端,甚至是后端,都在使用JavaSc ript。在本文中,將嘗試一些可用來(lái)使代碼看起來(lái)更簡(jiǎn)潔的實(shí)踐方案,希望能幫助到大家
    2021-09-09

最新評(píng)論