×ܽἸÌõJavascriptʵÓõÄÓï¾ä£¬¹©ÐÂÊÖ¿ìËÙѧϰÈëÃÅ£¬ÏàÐÅ»á¶ÔÄãÓкܴóµÄ°ïÖú¡£
¼Çסһµã£º¾¡ÐÅÊé²»ÈçÎÞÊé¡£ ѧϰÖØÔÚѧϰ·½·¨£¬ÒÔÏÂÄÚÈݽö¹©²Î¿¼£¡
1. document.write( " "); Êä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪ//
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document- >html- >(head,body)
4.Ò»¸öä¯ÀÀÆ÷´°¿ÚÖеÄDOM˳ÐòÊÇ:window- >(navigator,screen,history,location,document)
5.µÃµ½±íµ¥ÖÐÔªËصÄÃû³ÆºÍÖµ:document.getElementById( "±íµ¥ÖÐÔªËصÄID ").name(»òvalue)
6.Ò»¸öСдת´óдµÄJS: document.getElementById( "output ").value = document.getElementById( "input ").value.toUpperCase();
7.JSÖеÄÖµÀàÐÍ:String,Number,Boolean,Null,Object,Function
8.JSÖеÄ×Ö·ûÐÍת»»³ÉÊýÖµÐÍ:parseInt(),parseFloat()
9.JSÖеÄÊý×Öת»»³É×Ö·ûÐÍ:( " " ±äÁ¿)
10.JSÖеÄÈ¡×Ö·û´®³¤¶ÈÊÇ:(length)
11.JSÖеÄ×Ö·ûÓë×Ö·ûÏàÁ¬½ÓʹÓÃ.
12.JSÖеıȽϲÙ×÷·ûÓÐ:==µÈÓÚ,!=²»µÈÓÚ, >, >=, <. <=
13.JSÖÐÉùÃ÷±äÁ¿Ê¹ÓÃ:varÀ´½øÐÐÉùÃ÷
14.JSÖеÄÅж¨Óï¾ä½á¹¹:if(condition){}else{}
15.JSÖеÄÑ»·½á¹¹:for([initial expression];[condition];[upadte expression]) {inside loop}
16.Ñ»·ÖÐÖ¹µÄÃüÁîÊÇ:break
17.JSÖеĺ¯Êý¶¨Òå:function functionName([parameter],…){statement[s]}
18.µ±ÎļþÖгöÏÖ¶à¸öform±íµ¥Ê±.¿ÉÒÔÓÃdocument.forms[0],document.forms[1]À´´úÌæ.
19.´°¿Ú:´ò¿ª´°¿Úwindow.open(), ¹Ø±ÕÒ»¸ö´°¿Ú:window.close(), ´°¿Ú±¾Éí:self
20.×´BÀ¸µÄÉèÖÃ:window.status= "×Ö·û ";
21.µ¯³öÌáʾÐÅÏ¢:window.alert( "×Ö·û ");
22.µ¯³ö_ÈÏ¿ò:window.confirm();
23.µ¯³öÊäÈëÌáʾ¿ò:window.prompt();
24.Ö¸¶¨µ±Ç°ÏÔʾÁ´½ÓµÄλÖÃ:window.location.href= "URL "
25.È¡³ö´°ÌåÖеÄËùÓÐ±íµ¥µÄÊýÁ¿:document.forms.length
26.¹Ø±ÕÎĵµµÄÊä³öÁ÷:document.close();
27.×Ö·û´®×·¼ÓÁ¬½Ó·û: =
28.´´½¨Ò»¸öÎĵµÔªËØ:document.createElement(),document.createTextNode()
29.µÃµ½ÔªËصķ½·¨:document.getElementById()
30.ÉèÖÃ±íµ¥ÖÐËùÓÐÎı¾Ð͵ijÉÔ±µÄֵΪ¿Õ:
var form = window.document.forms[0]
for (var i = 0; i <form.elements.length;i ){
if (form.elements.type == "text "){
form.elements.value = " ";
}
}
31.¸´Ñ¡°´Å¥ÔÚJSÖÐÅж¨ÊÇ·ñÑ¡ÖÐ:document.forms[0].checkThis.checked (checkedÊôÐÔ´ú±íΪÊÇ·ñÑ¡Öзµ»ØTRUE»òFALSE)
32.µ¥Ñ¡°´Å¥×é(µ¥Ñ¡°´Å¥µÄÃû³Æ±ØÐëÏàͬ):È¡µ¥Ñ¡°´Å¥×éµÄ³¤¶Èdocument.forms[0].groupName.length
33.µ¥Ñ¡°´Å¥×éÅж¨ÊÇ·ñ±»Ñ¡ÖÐÒ²ÊÇÓÃchecked.
34.ÏÂÀÁбí¿òµÄÖµ:document.forms[0].selectName.options[n].value (nÓÐʱÓÃÏÂÀÁбí¿òÃû³Æ¼ÓÉÏ.selectedIndexÀ´_¶¨±»Ñ¡ÖеÄÖµ)
35.×Ö·û´®µÄ¶¨Òå:var myString = new String( "This is lightsword ");
36.×Ö·û´®×ª³É´óд:string.toUpperCase(); ×Ö·û´®×ª³ÉСд:string.toLowerCase();
37.·µ»Ø×Ö·û´®2ÔÚ×Ö·û´®1ÖгöÏÖµÄλÖÃ:String1.indexOf( "String2 ")!=-1Ôò˵Ã÷ûÕÒµ½.
38.È¡×Ö·û´®ÖÐÖ¸¶¨Î»ÖõÄÒ»¸ö×Ö·û:StringA.charAt(9);
39.È¡³ö×Ö·û´®ÖÐÖ¸¶¨ÆðµãºÍÖÕµãµÄ×Ó×Ö·û´®:stringA.substring(2,6);
40.Êýѧº¯Êý:Math.PI(·µ»ØÔ²ÖÜÂÊ),Math.SQRT2(·µ»Ø¿ª·½),Math.max(value1,value2)·µ»ØÁ½¸öÊýÖеÄ×îÔÚÖµ,Math.pow(value1,10)·µ»Ø
value1µÄÊ®´Î·½,Math.round(value1)ËÄÉáÎåÈ뺯Êý,Math.floor(Math.random()*(n 1))·µ»ØS»úÊý
41.¶¨ÒåÈÕÆÚÐͱäÁ¿:var today = new Date();
42.ÈÕÆÚº¯ÊýÁбí:dateObj.getTime()µÃµ½Ê±¼ä,dateObj.getYear()µÃµ½Äê·Ý,dateObj.getFullYear()µÃµ½ËÄλµÄÄê·Ý,dateObj.getMonth()µÃ
µ½Ô·Ý,dateObj.getDate()µÃµ½ÈÕ,dateObj.getDay()µÃµ½ÈÕÆÚ¼¸,dateObj.getHours()µÃµ½Ð¡Ê±,dateObj.getMinutes()µÃµ½
·Ö,dateObj.getSeconds()µÃµ½Ãë,dateObj.setTime(value)ÉèÖÃʱ¼ä,dateObj.setYear(val)ÉèÖÃÄê,dateObj.setMonth(val)ÉèÖÃ
ÔÂ,dateObj.setDate(val)ÉèÖÃÈÕ,dateObj.setDay(val)ÉèÖÃÐÇÆÚ¼¸,dateObj.setHoursÉèÖÃСʱ,dateObj.setMinutes(val)ÉèÖÃ
·Ö,dateObj.setSeconds(val)ÉèÖÃÃë [×¢ÖØ:´ËÈÕÆÚʱ¼ä´Ó0¿ªÊ¼¼Æ]
43.FRAMEµÄ±íʾ·½Ê½: [window.]frames[n].ObjFuncVarName,frames[ "frameName "].ObjFuncVarName,frameName.ObjFuncVarName
44.parent´ú±í¸¸Ç׶ÔÏó,top´ú±í×¶Ë¶ÔÏó
45.´ò¿ª×Ó´°¿ÚµÄ¸¸´°¿ÚΪ:opener
46.±íʾµ±Ç°ËùÊôµÄλÖÃ:this
47.µ±ÔÚ³¬Á´½ÓÖе÷ÓÃJSº¯ÊýʱÓÃ:(javascript :)À´¿ªÍ·ºóÃæ¼Óº¯ÊýÃû
48.ÔÚÀϵÄä¯ÀÀÆ÷Öв»Ö´ÐдËJS: <!– //– >
49.ÒýÓÃÒ»¸öÎļþʽµÄJS: <script type= "text/javascript " src= "aaa.js " > </script >
50.Ö¸¶¨ÔÚ²»Ö§³Ö½Å±¾µÄä¯ÀÀÆ÷ÏÔʾµÄHTML: <noscript > </noscript >
51.µ±³¬Á´ºÍonCLICKʼþ¶¼ÓÐʱ,ÔòÀÏ°æ±¾µÄä¯ÀÀÆ÷תÏòa.html,·ñÔòתÏòb.html.Àý: <a href= "a.html " >dfsadf </a >
52.JSµÄȽ¨¶ÔÏ
ÓÐ:Array,Boolean,Date,Error,EvalError,Function,Math,Number,
Object,RangeError,ReferenceError,RegExp,String,SyntaxError,
TypeErr
Object,RangeError,ReferenceError,RegExp,String,SyntaxError,
TypeErr
or,URIError
53.JSÖеĻ»ÐÐ: n
54.´°¿ÚÈ«ÆÁ´óС: <script >function fullScreen(){ this.moveTo
(0,0);
this.outerWidth=screen.availWidth;this.outerHeight=screen.availHeight;}
window.maximize=fullScreen; </script >
this.outerWidth=screen.availWidth;this.outerHeight=screen.availHeight;}
window.maximize=fullScreen; </script >
55.JSÖеÄall´ú±íÆäϲãµÄÈ«²¿ÔªËØ
56.JSÖеĽ¹µã˳Ðò:document.getElementByid( "±íµ¥ÔªËØ ").tabIndex = 1
57.innerHTMLµÄÖµÊÇ±íµ¥ÔªËصÄÖµ:Èç <p id= "para " > "how are <em >you </em > " </p >,ÔòinnerHTMLµÄÖµ¾ÍÊÇ:how are <em >you </em>
58.innerTEXTµÄÖµºÍÉÏÃæµÄÒ»Ñù,Ö»²»¹ý²»»á°Ñ <em >ÕâÖÖ˼ÇÏÔʾ³öÀ.
59.contentEditable¿ÉÉèÖÃÔªËØÊÇ·ñ¿É±»ÐÞ¸Ä,isContentEditable·µ»ØÊÇ·ñ¿ÉÐ޸ĵÄ×´B.
60.isDisabledÅж¨ÊÇ·ñΪ½ûÖ¹×´B.disabledÉèÖýûÖ¹×´B
61.lengthÈ¡µÃ³¤¶È,·µ»ØÕûÐÍÊýÖµ
62.addBehavior()ÊÇÒ»ÖÖJSµ÷ÓõÄÍⲿº¯ÊýÎļþÆäÀ©Õ¹ÃûΪ.htc
63.window.focus()ʹµ±Ç°µÄ´°¿ÚÔÚËùÓд°¿Ú֮ǰ.
64.blur()ָʧȥ½¹µã.ÓëFOCUS()Ïà·´.
65.select()Ö¸ÔªËØΪѡÖÐ×´B.
66.·ÀÖ¹Óû§¶ÔÎı¾¿òÖÐÊäÈëÎı¾:
67.È¡³ö¸ÃÔªËØÔÚÒ³ÃæÖгöÏÖµÄÊýÁ¿:document.all.tags( "div(»òÆäËüHTML˼Ƿ) ").length
68.JSÖзÖΪÁ½ÖÖ´°ÌåÊä³ö:Ä£BºÍ·ÇÄ£B.window.showModaldialog(),window.showModeless()
69.×´BÀ¸ÎÄ×ÖµÄÉèÖÃ:window.status= 'ÎÄ×Ö ',ĬÈϵÄ×´BÀ¸ÎÄ×ÖÉèÖÃ:window.defaultStatus = 'ÎÄ×Ö. ';
70.Ìí¼Óµ½ÊղؼÐ:external.AddFavorite( "http://www.dannyg.com ";, "jaskdlf ");
71.JSÖÐÅöµ½½Å±¾´íÎóʱ²»×öÈκβÙ×÷:window.onerror = doNothing; Ö¸¶¨´íÎó¾ä±úµÄÓ﷨Ϊ:window.onerror = handleError;
72.JSÖÐÖ¸¶¨µ±Ç°´ò¿ª´°¿ÚµÄ¸¸´°¿Ú:window.opener,Ö§³Öopener.opener…µÄ¶àÖؼÌÐø.
73.JSÖеÄselfÖ¸µÄÊǵ±Ç°µÄ´°¿Ú
74.JSÖÐ×´BÀ¸ÏÔʾÈÈ:window.status= "ÈÈ "
75.JSÖеÄtopÖ¸µÄÊÇ¿ò¼Ü¼¯ÖÐ×²ãµÄ¿ò¼Ü
76.JSÖйرյ±Ç°µÄ´°¿Ú:window.close();
77.JSÖÐÌá³öÊÇ·ñ_ÈϵĿò:if(confirm( "Are you sure? ")){alert( "ok ");}else{alert( "Not Ok ");}
78.JSÖеĴ°¿ÚÖض¨Ïò:window.navigate( "http://www.aseoe.com";);
79.JSÖеĴòÓ¡:window.print()
80.JSÖеÄÌáʾÊäÈë¿ò:window.prompt( "message ", "defaultReply ");
81.JSÖеĴ°¿Ú¹ö¶¯Ìõ:window.scroll(x,y)
82.JSÖеĴ°¿Ú¹ö¶¯µ½Î»ÖÃ:window.scrollby
83.JSÖÐÉèÖÃʱ¼ä¼ä¸ô:setInterval( "expr ",msecDelay)»òsetInterval(funcRef,msecDelay)»òsetTimeout
84.JSÖеÄÄ£BÏÔʾÔÚIE4 ÐÐ,ÔÚNNÖв»ÐÐ:showModalDialog( "URL "[,arguments][,features]);
85.JSÖеÄÍ˳ö֮ǰʹÓõľä±ú:function verifyClose()
{event.returnValue= "we really like you and hope you will stay longer. ";}}
{event.returnValue= "we really like you and hope you will stay longer. ";}}
window.=verifyClose;
86.µ±´°ÌåµÚÒ»´Îµ÷ÓÃʱʹÓõÄÎļþ¾ä±ú:onload()
87.µ±´°Ìå¹Ø±Õʱµ÷ÓõÄÎļþ¾ä±ú:onunload()
88.window.locationµÄÊôÐÔ: protocol(http:),hostname(www.example.com),port(80),
host(www.example.com:80),pathname
host(www.example.com:80),pathname
( "/a/a.html "),hash( "#giantGizmo ",Ö¸Ìøתµ½ÏàÓ¦µÄê¼Ç),href(È«²¿µÄÐÅÏ¢)
89.window.location.reload()ˢе±Ç°Ò³Ãæ.
90.window.history.back()·µ»ØÉÏÒ»Ò³,window.history.forward()·µ»ØÏÂÒ»Ò³,window.history.go(·µ»ØµÚ¼¸Ò³,Ò²¿ÉÒÔʹÓ÷ÃÎʹýµÄURL)
91.document.write()²»»»ÐеÄÊä³ö,document.writeln()»»ÐÐÊä³ö
92.document.body.noWrap=true;·ÀÖ¹Á´½ÓÎÄ×ÖÕÛÐÐ.
93.±äÁ¿Ãû.charAt(µÚ¼¸Î»),È¡¸Ã±äÁ¿µÄµÚ¼¸Î»µÄ×Ö·û.
94. "abc ".charCodeAt(µÚ¼¸¸ö),·µ»ØµÚ¼¸¸ö×Ö·ûµÄASCiiÂëÖµ.
95.×Ö·û´®Á¬½Ó:string.concat(string2),»òÓà =½øÐÐÁ¬½Ó
96.±äÁ¿.indexOf( "×Ö·û ",ÆðʼλÖÃ),·µ»ØµÚÒ»¸ö³öÏÖµÄλÖÃ(´Ó0¿ªÊ¼¼ÆËã)
97.string.lastIndexOf(searchString[,startIndex])×îºóÒ»´Î³öÏÖµÄλÖÃ.
98.string.match(regExpression),Åж¨×Ö·ûÊÇ·ñÆ¥Åä.
99.string.replace(regExpression,replaceString)Ìæ»»ÏÖÓÐ×Ö·û´®.
100.string.split(·Ö¸ô·û)·µ»ØÒ»¸öÊý×é´æ´¢Öµ.
101.string.substr(start[,length])È¡´ÓµÚ¼¸Î»µ½Ö¸¶¨³¤¶ÈµÄ×Ö·û´®.
102.string.toLowerCase()ʹ×Ö·û´®È«²¿±äΪСд.
103.string.toUpperCase()ʹȫ²¿×Ö·û±äΪ´óд.
104.parseInt(string[,radix(´ú±í½øÖÆ)])Ç¿ÖÆת»»³ÉÕûÐÍ.
105.parseFloat(string[,radix])Ç¿ÖÆת»»³É¸¡µãÐÍ.
106.isNaN(±äÁ¿):²âÊÔÊÇ·ñΪÊýÖµÐÍ.
107.¶¨Òå³£Á¿µÄÒªº¦×Ö:const,¶¨Òå±äÁ¿µÄÒªº¦×Ö:var
TAG:Javascript ʵÓÃÓï¾ä
±¾Õ¾»¶ÓÈκÎÐÎʽµÄתÔØ£¬µ«ÇëÎñ±Ø×¢Ã÷³ö´¦£¬×ðÖØËûÈËÀͶ¯³É¹û
תÔØÇë×¢Ã÷£º ÎÄÕÂתÔØ×Ô£º°®Ë¼×ÊÔ´Íø http://www.aseoe.com/show-12-297-1.html
תÔØÇë×¢Ã÷£º ÎÄÕÂתÔØ×Ô£º°®Ë¼×ÊÔ´Íø http://www.aseoe.com/show-12-297-1.html