1¡¢¶ÔÏóÊôÐÔ£º.lengthΪ³¤¶ÈÊôÐÔ£¬
.toUpperCase()Ϊ´óд×ÖĸÎı¾
2¡¢indexofº¯Êý·½·¨·µ»Ø×Ö·û´®ÄÚµÚÒ»´Î³öÏÖ×Ö·û´®µÄ×Ö·ûλÖã¬×Ö·û´®µÄλÖôÓ0¿ªÊ¼£¬Èç¹ûûÓÐÕÒµ½×Ó×Ö·û´®£¬Ôò·µ»Ø-1
3¡¢match()·½·¨¿ÉÓÃÀ´ÕÒµ½×Ö·û´®ÖÐÌض¨µÄ×Ö·û£¬Èç¹ûÕÒµ½Ôò·µ»ØÕâ¸ö×Ö·û£¬Èç¹ûûÓÐÕÒµ½Ôò·µ»Ønull
4¡¢ÓÃreplace()Ìæ´ú×Ö·û´®ÖеÄ×Ö·û
Var str =”hello word!”
Document.write(str.replace(/word/,”sp”)) //ÊÇ°ÑwordÌæ»»³Ésp
5¡¢ÈÕÆÚ¶ÔÏó£º
ʹÓÃDate()·½·¨¿É»ñµÃµ±ÈÕµÄÈÕÆÚ
ʹÓÃgetTime()¼ÆËãÄê·Ý
6¡¢Ê¹ÓÃconcat()·½·¨ºÏ²¢Á½¸öÊý×飬ÐÎʽΪ1.concat(2)¼´Îª°ÑÊý×é1ºÍÊý×é2ºÏ²¢ÆðÀ´
7¡¢Ê¹ÓÃjoin()·½·¨½«ËùÓÐÊý×éµÄËùÓÐÔªËØ×é³ÉÒ»¸ö×Ö·û´®
Join()ĬÈϵÄΪ¶ººÅ£¬join(.)ÔòÔÚËùÓеÄÊý×é¼äÓõãºÅÁ¬½Ó
8¡¢ÓÃBoolean()¼ì²é¶ÔÏóÊÇ·ñÊÇÂß¼Öµ£¬ÊÇÔò·µ»Øtrue£¬·ñÔò·µ»Øfalse£»ÈçBoolean(0)Ϊfalse
9¡¢round() º¯ÊýÊä³öËÄÉáÎåÈëµÄÕûÊýÖµ£¬random()º¯ÊýÊä³ö0µ½1Ö®¼äËæ»úµÄÊý£¬ËüÃǵĶÔÏó¾ùÊÇMath£¬¼´ÎªMath.round() Math.random()
10¡¢ÕýÔò±í´ïʽRegExp,¶ÔÏóÓÐÈý¸ö· ......
JavaScriptÖÐÌṩÁËһЩ·Ç³£ÓÐÓõÄÄÚ²¿¶ÔÏó×÷Ϊ¸ÃÓïÑԹ淶µÄÒ»²¿·Ö£¬Ã¿Ò»¸öÄÚ²¿¶ÔÏó¶¼ÓÐһЩ·½·¨ºÍÊôÐÔ¡£
JavaScriptÖÐÌṩµÄÄÚ²¿¶ÔÏó°´Ê¹Ó÷½Ê½¿ÉÒÔ·ÖΪ¶¯Ì¬¶ÔÏóºÍ¾²Ì¬¶ÔÏó¡£
¶¯Ì¬¶ÔÏó£ºÔÚÒýÓÃËûµÄÊôÐԺͷ½·¨ÊÇ£¬±ØÐëʹÓÃnew¹Ø¼ü×Ö´´½¨Ò»¸ö¶ÔÏóʵÀý£¬È»ºó²Å¿ÉÒÔʹÓÓ¶ÔÏóʵÀýÃû.³ÉÔ±”µÄ¸ñʽÀ´·ÃÎÊÆäÊôÐԺͷ½·¨¡£
¾²Ì¬¶ÔÏó£ºÔÚÒýÓøöÔÏóµÄÊôÐԺͷ½·¨Ê±£¬²»ÐèҪʹÓÃnew¹Ø¼ü×Ö´´½¨¶ÔÏóʵÀý£¬Ö±½ÓʹÓÓ¶ÔÏóʵÀýÃû.³ÉÔ±”µÄ¸ñʽ¾Í¿ÉÒÔ·ÃÎÊÆäÊôÐԺͷ½·¨ÁË¡£
ÏÂÃæ½éÉܼ¸ÖÖ³£ÓõÄÄÚ²¿¶ÔÏó£º
Ò»¡¢Object¶ÔÏó
Object¶ÔÏóÌṩÁËJavaScript¶ÔÏóµÄ×î»ù±¾¹¦ÄÜ£¬ÕâЩ¹¦Äܹ¹³ÉÁËÆäËûËùÓÐJavaScript¶ÔÏóµÄ»ù´¡¡£ËüÌṩÁËÒ»ÖÖ´´½¨×Ô¶¨Òå¶ÔÏóµÄ¼òµ¥·½Ê½£¬²»ÐèÒªÔÙ¶¨Òå¹¹Ô캯Êý£¬Ëü¿ÉÒÔÔÚ³ÌÐòÔËÐйý³ÌÖÐΪJavaScript¶ÔÏóËæÒâÌí¼ÓÊôÐÔ¡£ËûÊÇÒ»¸ö¶¯Ì¬¶ÔÏó¡£
Àý×Ó£º5.5.1
¶þ¡¢string¶ÔÏó
String¶ÔÏóÊǶ¯Ì¬¶ÔÏó£¬ÐèÒª´´½¨¶ÔÏóʵÀýºó²Å¿ÉÒÔÒýÓÃËûµÄÊôÐÔ»ò·½·¨£¬¿ÉÒÔ°ÑÓõ¥ÒýºÅ»òË«ÒýºÅÀ¨ÆðÀ´µÄÒ»¸ö×Ö·û´®µ±×÷Ò»¸ö×Ö·û´®µÄ¶ÔÏóʵÀýÀ´¿´´ý£¬Ò²¾ÍÊÇ˵¿ÉÒÔÖ±½ÓÔÚij¸ö×Ö·û´®ºóÃæ¼ÓÉÏ£¨.£©È¥µ÷ÓÃstring¶ÔÏóµÄÊôÐԺͷ½·¨¡£
1¡¢ÊôÐÔ
String¶ÔÏóÖÐ×î³£ÓõÄÊôÐÔ¾ÍÊÇlength£¬± ......
JavaScriptÓµÓÐÄÚÖöÔÏóºÍ×Ô¶¨Òå¶ÔÏó£¬ÊÂʵÉϸ÷ÖÖÊý¾ÝÀàÐ͵ıäÁ¿¶¼ÊôÓÚÒ»ÖÖ¶ÔÏ󣬱äÁ¿ÔÚÉùÃ÷ºÍ¸³ÖµºóÂíÉÏÓµÓжÔÓ¦µÄ·½·¨ºÍ¶ÔÏó¡£
¡¡¡¡1.JavaScriptÄÚÖöÔÏóµÄÖÖÀà
¡¡¡¡JavaScript¶ÔÏóÒÀÕÕ½¨Á¢·½Ê½²»Í¬¿É·ÖΪʹÓñäÁ¿ÉùÃ÷µÄÒþÐÔ¶ÔÏóºÍʹÓÃnewÃüÁî¶ÔÁ¢¶ÔÏ󸱱¾µÄÏÔÐÔ¶ÔÏó¡£
¡¡¡¡
¡¡¡¡ÒþÐÔ¶ÔÏó(Implicit[im'plisit] Objects)
¡¡¡¡JavaScripttµÄ¸÷ÖÖÊý¾ÝÀàÐͱäÁ¿£¬ÔÚÉùÃ÷ºÍ¸³Öµºó¾ÍÊÇÒ»¸ö¶ÔÏó£¬ÀýÈçÊý×Ö¡¢×Ö·û´®ºÍ²¼¶ûÊý¾ÝÀàÐ͵ıäÁ¿µÈ£¬ÈçÏÂËùʾ£º
¡¡¡¡ 1.var str="JavaScriptѧϰ±Ê¼Ç";
¡¡¡¡ÉÏÊö³ÌÐò´úÂëÉùÃ÷±äÁ¿strÊÇÒ»¸öÒþÐÔString¶ÔÏó£¬ËäÈ»¿ÉÒÔʹÓÃString¶ÔÏóµÄ·½·¨£¬µ«ÊÇÒþÐÔ¶ÔÏó²¢²»Ö§³ÖprototypeÊôÐÔ£¬ÈçÏÂËùʾ£º
¡¡¡¡ 1.str.prototype.count;
¡¡¡¡ÉÏÊö³ÌÐò´úÂë»áµ¼ÖÂJavaScript³ÌÐòÔËÐÐʱ³öÏÖ´íÎ󣬶øÇÒÒþÐÔ¶ÔÏóÒ²²»Ö§³ÖExpandoÊôÐÔ£¬ÎÞ·¨ÈÎÒâÀ©Õ¹¶ÔÏóµÄÊôÐÔ¡£
¡¡¡¡
¡¡¡¡ÏÔÐÔ¶ÔÏó(Explicit[iks'plisit] Objects)
¡¡¡¡JavaScriptµÄ¶ÔÏóÈç¹ûʹÓÃnewÃüÁÁ¢¶ÔÏ󸱱¾£¬Ôò´Ë¶ÔÏó¾ÍÊÇÒ»¸öÏÔÐÔ¶ÔÏó£¬ÈçÏÂËùʾ£º
¡¡¡¡ 1.var str=new String("JavaScriptѧϰ±Ê¼Ç");
¡¡¡¡ÉÏÊö³ÌÐò´úÂ뽨Á¢µÄÒ²ÊÇÒ»¸ö×Ö·û´®±äÁ¿£¬²»¹ýÕâÊÇÒ»¸öString¶ÔÏó£¬ÏÔÐÔ¶ÔÏóͬʱ֧³ÖExpandoº ......
1£®ÈçºÎ»ñÈ¡±íµ¥<select>ÓòµÄÑ¡Ôñ²¿·ÖµÄÎı¾£¿
<form name="a">
<select name="a" size="1" onchange="_sel(this)">
<option value="a">1</option>
<option value="b">2</option>
<option value="c">3</option>
</select>
</form>
<mce:script type="text/javascript"><!--
function _sel(obj){
alert("ÏÔʾÎı¾£º" + obj.options[obj.selectedIndex].text);
alert("Öµ£º" + obj.options[obj.selectedIndex].value);
}
// --></mce:script>
2.javascript¿ØÖÆÒ³Ãæ¿Ø¼þÒþ²ØÏÔʾµÄÁ½ÖÖ·½·¨
javascript¿ØÖÆÒ³Ãæ¿Ø¼þÒþ²ØÏÔʾµÄÁ½ÖÖ·½·¨£¬·½·¨µÄ²»Í¬Ö®´¦ÔÚÓڿؼþÒþ²ØºóÊÇ·ñ»¹ÔÚÒ³ÃæÉÏռλ
·½·¨Ò»£º
document.all["PanelSMS"].style.visibility="hidden";
document.all["PanelSMS"].style.visibility="visible";
·½·¨¶þ£º
document.all["PanelSMS"].style.display="none";
document.all["PanelSMS"].style.display="inline";
·½·¨Ò»Òþ²Øºó Ò³ÃæµÄλÖû¹±»¿Ø¼þÕ¼Óà ......
<a href="<%=Request.ServerVariables("HTTP_REFERER")%>">·µ»ØÉÏÒ»²½</a>
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4. oncopy="return false;" oncut="return false;" ·ÀÖ¹¸´ÖÆ
5. <link rel="Shortcut Icon" href="favicon.ico"> IEµØÖ·À¸Ç°»»³É×Ô¼ºµÄͼ±ê
6. <link rel="Bookmark" href="favicon.ico"> ¿ÉÒÔÔÚÊղؼÐÖÐÏÔʾ³öÄãµÄͼ±ê
7. <input style="ime-mode:disabled"> ¹Ø±ÕÊäÈë·¨
8. ÓÀÔ¶¶¼»á´ø×Å¿ò¼Ü ......
This document is for establishing build standard for JavaScript and CSS compression
The objective for this document is to establish a companywide JavaScript and CSS compression standard that can be shared crossing multiple SharePoint product development projects. This is the first draft
Overview
Our SharePoint development involves many client side scripts programming style sheet design. In order to improve JavaScript and CSS loading performance and protect our work from copying, we need to establish a standard way to make our script and css shorter and hard to read. Following steps will help you to understand how to do it without knowing all implementation details.
Step 1: Build Compression Environment
System Requirement: Windows XP/Server 2003 Virtual Environment.
Software: JDK 1.4+, yuicompressor-2.4.2.jar
Step 2: JavaScript Naming Standard
1) JavaScript Naming Standard: name-x.y.z.js
2) Compressed JavaScript Naming Standard: na ......