Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ÍøÒ³ÖÆ×÷Javascript¾­µäС¼¼ÇÉ

 ×ª×Ôhttp://topic.csdn.net/u/20091014/12/44b0ac69-5228-429b-854a-a91e3736f1d4.html?64368
ÿһÏÊÇJSÖеÄС¼¼ÇÉ£¬µ«Ê®·ÖµÄʵÓã¡
1.document.write(”"); Êä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪ//
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document->html->(head,body)
4.Ò»¸öä¯ÀÀÆ÷´°¿ÚÖеÄDOM˳ÐòÊÇ:window->(navigator,screen,history,locetion,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.״̬À¸µÄÉèÖÃ:window.status="×Ö·û";
21.µ¯³öÌáʾÐÅÏ¢:window.alert("×Ö·û");
22.µ¯³öÈ·ÈÏ¿ò:window.confirm();
23.µ¯³öÊäÈëÌáʾ¿ò:window.prompt();
24.Ö¸¶¨µ±Ç°ÏÔʾÁ´½ÓµÄλÖÃ:window.locetion.href="URL"
25.È¡³ö´°ÌåÖеÄËùÓÐ±íµ¥µÄÊýÁ¿:document.forms.length
26.¹Ø±ÕÎĵµµÄÊä³öÁ÷:document.close();
27.×Ö·û´®×·¼ÓÁ¬½Ó·û:+=
28.´´½¨Ò»¸öÎĵµÔªËØ:document.createElement(),document.createTextNode()
29.µÃµ½ÔªËصķ½·¨:document.getElementById()
30.ÉèÖÃ±íµ¥ÖÐËùÓÐÎı¾Ð͵ijÉÔ±µÄֵΪ¿Õ:
for (var i = 0; i <document.forms.length;i++){
var form = window.document.forms[i] ;
if (form.elements.type == "text"){
form.elements.value = "";
}
}
31.¸´Ñ¡°´Å¥ÔÚJSÖÐÅжÏÊÇ·ñÑ¡ÖÐ:document.for


Ïà¹ØÎĵµ£º

ÈÏʶjavascriptµÄObject¹¦ÄÜÓëÐÔÖÊ

jsÖеÄÈκζÔÏ󶼼̳ÐObjectº¯ÊýÀ࣬Òò´Ë¶¼Object.prototype°üº¬µÄËùÓз½·¨¡£½ñÌìÎÒ¾ÍÀ´ÌÖÂÛÏÂÕâЩ×î»ù±¾µÄ·½·¨ºÍÔõÑùÈ¥ÖØд¡£
Ê×ÏÈ£¬°üº¬7¸ö×î»ù±¾µÄº¯Êý£º
function A()
{
var obj = {};
obj.constructor //Objectº¯Êý
obj.hasOwnProperty //ÅжϲÎÊýÊÇ·ñÊÇobj¶ÔÏóµÄ±¾µØ·ÇprotorypeÊôÐÔ
obj.isPrototype ......

javascript trim

×î½ü×öË°Îñ×ÛºÏƽ̨¹¤×÷Á÷£¬ ÔÚÒ³ÃæÉÏÅжÏÊÇ·ñÊÇ“»õ±Ò½ð¶î”¸ñʽ£¬Ê¹ÓõÄÊÇÕýÔò±í´ïʽ£¬Ò»Ö±¶¼Ã»ÓÐÎÊÌ⣬
ºóÀ´Í»È»ÎÞ·¨ÑéÖ¤£¬ ¾ÍÊDz»·ûºÏÕýÔò±í´ïʽµÄ½á¹¹£¬×îºóÖÕÓÚ·¢ÏÖ ½ð¶îºóÃæ°üº¬¿Õ¸ñ×Ö·û´®£¬ÔÚÍøÉÏÕÒµ½Ò»¶Î´úÂë £¬ÕýºÃ½â¾ö¡£
String.prototype.trim= function(){
   // ÓÃÕýÔò±í´ïʽ½«Ç°ºó¿ ......

javascriptʼþÁбí


javascriptʼþÁбí½â˵
ʼþ
ä¯ÀÀÆ÷Ö§³Ö
½â˵
Ò»°ãʼþ
onclick
IE3¡¢N2
Êó±êµã»÷ʱ´¥·¢´Ëʼþ
ondblclick
IE4¡¢N4
Êó±êË«»÷ʱ´¥·¢´Ëʼþ
onmousedown
IE4¡¢N4
°´ÏÂÊó±êʱ´¥·¢´Ëʼþ
onmouseup
IE4¡¢N4
Êó±ê°´ÏºóËÉ¿ªÊó±êʱ´¥·¢´Ëʼþ
onmouseover
IE3¡¢N2
µ±Êó±êÒƶ¯µ½Ä³¶ÔÏó·¶Î§µÄÉÏ·½Ê±´¥·¢´Ëʼ ......

javascript¶¯Ì¬´´½¨¿Ø¼þµÄ3ÖÖ·½·¨

ÒÔ´´½¨°´Å¥ÎªÀý
<html>
<head>
   <script>
    function add1()
   {
   var obtn=document.createElement("input");
obtn.setAttribute("type","button");
obtn.setAttribute("value","test1");
document.body.appendChild(obtn);//×¢ÒâÈç¹ûÓÐf ......

½â¶ÁjavascriptµÄ¼ÆʱÆ÷

˵Ã÷£ºÕâƪÎÄÕ½ÚÑ¡×ÔJohn Resig
µÄ¡¶Secrets of the JavaScript Ninja¡·Ò»Ê飬±¾ÈË·­ÒëÖ»Êǹ©´ó¼Òѧϰ£¬·­Òë²»×ãÖ®´¦£¬Ç븫Õý¡£
ÕâƪÎÄÕÂÖ÷Òª´ÓÏÂÃ漸¸ö·½Ãæ½â¶Á¼ÆʱÆ÷£º
¼ÆʱÆ÷¸ÅÊö£»
¼ÆʱÆ÷ËÙ¶ÈÉî¶È̽Îö£»
ÓüÆʱÆ÷´¦Àí´óÁ¿ÈÎÎñ£»
ÀûÓüÆʱÆ÷¹ÜÀí¶¯»­£»
½ÏºÃµÄ¼ÆʱÆ÷²âÊÔ
¼ÆʱÆ÷ÊÇÒ»¸öÎÒÃÇÁ˽âºÜÉÙÇÒ¾­³£±» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ