Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : javascript

JavaScriptÔÓ̸

1¡¢JS½âÊÍ˳Ðò
JavaScriptÊÇ°´HTMLÎĵµÁ÷˳ÐòÖ´Ðеģ¬·Ö<script>¿é˳ÐòÖ´ÐУ¬JSÊÇÏÈÔ¤±àÒëÔÙÖ´ÐУ¬È»ºóÔٱ߱àÒë±ßÖ´ÐеÄÓïÑÔ£¬ÀýÈ磺
alert(a);   //undefined
var a = 1;
alert(a);  //1
Ϊʲô»á³öÏÖÉÏÊö½á¹ûÄØ£¿
´ð°¸£ºa±äÁ¿ÔÚÔ¤±àÒëµÄʱºò£¬ÒѾ­´æÔÚÄÚ´æÖУ¬È»ºóJSÒýÇ濪ʼִÐÐJS´úÂ룬µ«ÊÇÓÉÓÚ±äÁ¿µÄ³õʼ»¯²Ù×÷ʱ·¢ÉúÔÚÖ´ÐÐÆڼ䣬Ҳ¾ÍÊÇ˵£¬Ö´Ðе½µÚÒ»¸öalert(a);ʱ£¬a»¹Î´³õʼ»¯£¨»¹Î´Ö´ÐÐa = 1Õâ¶Î´úÂ룩£¬Òò´ËÊä³öundefined£¬ºóÃæÄǸöÔòÊä³ö1.
ºóÃæ´ýÐø~~~ ......

JavaScriptѧϰ±Ê¼Ç£¨Èý£©

1.°Ñ¶ÔÏóµÄËùÓÐÒýÓö¼ÉèÖÃΪnull£¬¿ÉÒÔÇ¿ÖÆÐԵķϳý¶ÔÏ󣨼´Í¨Öª´æ´¢µ¥ÔªÊÕ¼¯³ÌÐòÏú»Ù¶ÔÏóÀ´ÊÍ·ÅÄڴ棩¡£ÕâÊǸöºÃÏ°¹ß¡£
2.ArrayÀ༴Êý×éÀ࣬¿ÉÒÔÈç϶¨Ò壺
      var aColors=new Array();
      aColors[0]="blue";
      aColors[1]="red";
      alert(aColors.length);   //µ¯³ö“2”
   JavaScriptÖеÄÊý×é¿ÉÒÔ¶¯Ì¬Ôö³¤¡£»¹¿ÉÒÔÓÃ×ÖÃæÁ¿À´¶¨ÒåÊý×飬È磺
      var aColors=["blue","red","green"];
   join()£ºÀûÓòÎÊý×÷Ϊ·Ö¸ô·û£¬·µ»ØÓÐÐòµÄÊý×éÔªËØÖµµÄ×Ö·û´®¡£¶ÔÓ¦µÄ£¬StringÀàÖÐÓÐsplit()·½·¨×÷Ϊ½«×Ö·û´®×ª»»ÎªÊý×éµÄ¹¤¾ß¡£
   push()£ºÔÚArrayβ²¿Ìí¼ÓÔªËØ
   pop()£ºÉ¾³ýArray×îºóÒ»¸öÔªËØ
   unshift()£ºÔÚArrayÍ·²¿Ìí¼ÓÔªËØ
   shift()£ºÉ¾³ýArrayµÚÒ»¸öÔªËØ
   NB
£ºÀûÓÃpush()ºÍpop()·½·¨¿ÉÒÔÄ£ÄâÕ»£¬ÀûÓÃpush()ºÍunshift()·½·¨¿ÉÒÔÄ£Äâ¶ÓÁС£
 &nb ......

Javascript CSS¼ÇÊÂ

×¢£º"elm"´ú±íij¸öDOMÔªËØ£¬"xxx"´ú±íij¸öCSSÊôÐÔ
Ò»¡¢elm.style.xxx  Ö»ÄÜ»ñÈ¡ÄÚÁªÑùʽÀïµÄÖµ
ÒªÏë»ñµÃÕýÈ·µÄcssÖµ£º
IE£ºelm.currentStyle[xxx]
W3C±ê×¼£ºdocument.defaultView.getComputedStyle(elm,"")[xxx]
×¢Ò⣺ÓÃIE·½·¨·µ»ØÖµ¿ÉÄܲ»ÊÇÊý×Ö£¬¶øÊÇauto£»ÓÃw3cµÄ·½·¨×ÜÊǻ᷵»ØÊý×Ö+µ¥Î»
Èý¡¢offsetLeft
1.ä¯ÀÀÆ÷ÊÇ·ñ»á°ÑbodyµÄ¸÷¸öÊôÐÔÖµ(margin,padding,border)°üÀ¨ÔÚoffsetLeftÄÚ£¿
 IE6/7IE8Firefox
margin-left
·ñ
ÊÇ
ÊÇ
padding-left
ÊÇ
ÊÇ
ÊÇ
border-left
·ñ
ÊÇ
·ñ
2.¸¸ÔªËصÄÊôÐÔÖµÒ²»á°üÀ¨ÔÚoffsetLeftÄÚ
3.¶ÔÓÚÔªËØ×ÔÉíµÄÊôÐÔÖµ£¬Ö»ÓÐmargin-left»á±»°üÀ¨ÔÚoffsetLeftÄÚ
4.ÔÚÔªËØ display:none Çé¿öÏ offsetLeft µÄÖµ£º  IE6/7:-1    IE8/Firefox:0
5.visibility:hidden²»»áÓ°ÏìoffsetLeft
6.bodyµÄoffsetLeftÖµ:
   A.IE6/7»á°ÑbodyµÄmargin-left°üÀ¨ÔÚÆäoffsetLeftÄÚ
   B.ÈôbodyÓпí¶ÈΪxµÄ±ß¿ò(border)£¬ÔÚFirefoxÀïbodyµÄoffsetLeft»á±ä³É-x
ËÄ¡¢offsetTop
Çé¿öÓëoffsetLeftÒ»Ñù
Îå¡¢offsetWidthºÍoffsetHeight
ÔÚËùÓÐÖ÷Á÷ä¯ÀÀÆ÷ÀÕâÁ½¸öÊôÐ ......

Javascript CSS¼ÇÊÂ

×¢£º"elm"´ú±íij¸öDOMÔªËØ£¬"xxx"´ú±íij¸öCSSÊôÐÔ
Ò»¡¢elm.style.xxx  Ö»ÄÜ»ñÈ¡ÄÚÁªÑùʽÀïµÄÖµ
ÒªÏë»ñµÃÕýÈ·µÄcssÖµ£º
IE£ºelm.currentStyle[xxx]
W3C±ê×¼£ºdocument.defaultView.getComputedStyle(elm,"")[xxx]
×¢Ò⣺ÓÃIE·½·¨·µ»ØÖµ¿ÉÄܲ»ÊÇÊý×Ö£¬¶øÊÇauto£»ÓÃw3cµÄ·½·¨×ÜÊǻ᷵»ØÊý×Ö+µ¥Î»
Èý¡¢offsetLeft
1.ä¯ÀÀÆ÷ÊÇ·ñ»á°ÑbodyµÄ¸÷¸öÊôÐÔÖµ(margin,padding,border)°üÀ¨ÔÚoffsetLeftÄÚ£¿
 IE6/7IE8Firefox
margin-left
·ñ
ÊÇ
ÊÇ
padding-left
ÊÇ
ÊÇ
ÊÇ
border-left
·ñ
ÊÇ
·ñ
2.¸¸ÔªËصÄÊôÐÔÖµÒ²»á°üÀ¨ÔÚoffsetLeftÄÚ
3.¶ÔÓÚÔªËØ×ÔÉíµÄÊôÐÔÖµ£¬Ö»ÓÐmargin-left»á±»°üÀ¨ÔÚoffsetLeftÄÚ
4.ÔÚÔªËØ display:none Çé¿öÏ offsetLeft µÄÖµ£º  IE6/7:-1    IE8/Firefox:0
5.visibility:hidden²»»áÓ°ÏìoffsetLeft
6.bodyµÄoffsetLeftÖµ:
   A.IE6/7»á°ÑbodyµÄmargin-left°üÀ¨ÔÚÆäoffsetLeftÄÚ
   B.ÈôbodyÓпí¶ÈΪxµÄ±ß¿ò(border)£¬ÔÚFirefoxÀïbodyµÄoffsetLeft»á±ä³É-x
ËÄ¡¢offsetTop
Çé¿öÓëoffsetLeftÒ»Ñù
Îå¡¢offsetWidthºÍoffsetHeight
ÔÚËùÓÐÖ÷Á÷ä¯ÀÀÆ÷ÀÕâÁ½¸öÊôÐ ......

Javascript֮ͼƬÅÜÂíµÆ

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>ͼƬÅÜÂíµÆ</title>
</head>
<body>
    <div align="center" id="demo" style="overflow: hidden; height: 33px; width: 400px;
        border-width: 1px 1px 1px 1px; border-style: dotted dotted dotted dotted;">
        <table border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td id="demo1">
                    <img src="images/logo_1.gif"><img src="images/logo/flashempire.gif"><img src="images/logo.gif"><img
            & ......

javascriptÍøÒ³¶Ô»°¿ò²ÎÊýÏê½â

N.1 »ù±¾½éÉÜ£º
    * showModalDialog() (IE 4+ Ö§³Ö)£¬ÓÃÀ´´´½¨Ò»¸öÏÔʾHTMLÄÚÈݵÄģ̬¶Ô»°¿ò¡£
    * showModelessDialog() (IE 5+ Ö§³Ö) £¬ÓÃÀ´´´½¨Ò»¸öÏÔʾHTMLÄÚÈݵķÇģ̬¶Ô»°¿ò¡£
N.2 ʹÓ÷½·¨£º
    * vReturnValue = window.showModalDialog(sURL [, vArguments] [,sFeatures])
    * vReturnValue = window.showModelessDialog(sURL [, vArguments] [,sFeatures])
N.2.1 ²ÎÊý˵Ã÷£º
    * sURL-- ±ØÑ¡²ÎÊý£¬ÀàÐÍ£º×Ö·û´®¡£ÓÃÀ´Ö¸¶¨¶Ô»°¿òÒªÏÔʾµÄÎĵµµÄURL¡£
    * vArguments-- ¿ÉÑ¡²ÎÊý£¬ÀàÐÍ£º±äÌå¡£ÓÃÀ´Ïò¶Ô»°¿ò´«µÝ²ÎÊý¡£´«µÝµÄ²ÎÊýÀàÐͲ»ÏÞ£¬°üÀ¨Êý×éµÈ¡£¶Ô»°¿òͨ¹ýwindow.dialogArgumentsÀ´È¡µÃ´«µÝ½øÀ´µÄ²ÎÊý¡£
    * sFeatures-- ¿ÉÑ¡²ÎÊý£¬ÀàÐÍ£º×Ö·û´®¡£ÓÃÀ´ÃèÊö¶Ô»°¿òµÄÍâ¹ÛµÈÐÅÏ¢£¬¿ÉÒÔʹÓÃÒÔϵÄÒ»¸ö»ò¼¸¸ö£¬Ó÷ֺœ;”¸ô¿ª¡£
         1. dialogHeight :¶Ô»°¿ò¸ß¶È£¬²»Ð¡ÓÚ£±£°£°px£¬£É£Å£´ÖÐdialogHeight ºÍ dialogWidth ĬÈϵĵ¥Î»ÊÇem£¬¶ø£É£Å£µÖÐÊÇpx£¬Îª·½±ãÆä¼û£¬ ......

javascript»ñÈ¡²¢·ÖÎöURL(html?id=*µÈÎÊÌâ)

1.»ñÈ¡URL
»ñÈ¡urlµÄ·½·¨£¬Ö±½ÓÓÃlocation¾Í¿ÉÒÔÁË£¬window.location»òwindow.loation.hrefÒ²¿ÉÒÔ¡£
2.·ÖÎöURL
ÔËÓÃlocation»ñÈ¡µÄurlµÄÊôÐÔΪobject£¬Òª¶ÔÆä½øÐÐ×Ö·û´®µÄ·ÖÎö²Ù×÷£¬ÐèÒªÏȽ«Æäת»»Îª×Ö·û´®¡£
ÓÃlocationÀ´½øÐд¦Àí£¬Ê×ÏȽ«Æäת»»Îª×Ö·û´®£¬Óú¯ÊýtoString()£¬URL.toString();
¸½Ò»Ð©URL²ÎÊý
ÍêÕûµÄURLÓÉÕ⼸¸ö²¿·Ö¹¹³É£º
scheme://host:port/path?query#fragment
scheme = ͨÐÅЭÒé (³£ÓõÄhttp,ftp,maitoµÈ)
host = Ö÷»ú (ÓòÃû»òIP)
port = ¶Ë¿ÚºÅ
path = ·¾¶
query = ²éѯ
¿ÉÑ¡£¬ÓÃÓÚ¸ø¶¯Ì¬ÍøÒ³£¨ÈçʹÓÃCGI¡¢ISAPI¡¢PHP/JSP/ASP/ASP.NETµÈ¼¼ÊõÖÆ×÷µÄÍøÒ³£©´«µÝ²ÎÊý£¬¿ÉÓжà¸ö²ÎÊý£¬ÓÔ&”·ûºÅ¸ô¿ª£¬Ã¿¸ö²ÎÊýµÄÃûºÍÖµÓÔ=”·ûºÅ¸ô¿ª¡£
fragment = ÐÅϢƬ¶Ï
×Ö·û´®£¬ÓÃÓÚÖ¸¶¨ÍøÂç×ÊÔ´ÖеÄƬ¶Ï¡£ÀýÈçÒ»¸öÍøÒ³ÖÐÓжà¸öÃû´Ê½âÊÍ£¬¿ÉʹÓÃfragmentÖ±½Ó¶¨Î»µ½Ä³Ò»Ãû´Ê½âÊÍ¡£(Ò²³ÆΪêµã.)
¶ÔÓÚÕâÑùÒ»¸öURL
http://www.master8.net:80/seo/?ver=1.0&id=6#imhere
ÎÒÃÇ¿ÉÒÔÓÃjavascript»ñµÃÆäÖеĸ÷¸ö²¿·Ö
1, window.location.href
Õû¸öURl×Ö·û´®(ÔÚä¯ÀÀÆ÷ÖоÍÊÇÍêÕûµÄµØÖ·À¸)
2,window.location.protocol
URL ......

javascript»ñÈ¡²¢·ÖÎöURL(html?id=*µÈÎÊÌâ)

1.»ñÈ¡URL
»ñÈ¡urlµÄ·½·¨£¬Ö±½ÓÓÃlocation¾Í¿ÉÒÔÁË£¬window.location»òwindow.loation.hrefÒ²¿ÉÒÔ¡£
2.·ÖÎöURL
ÔËÓÃlocation»ñÈ¡µÄurlµÄÊôÐÔΪobject£¬Òª¶ÔÆä½øÐÐ×Ö·û´®µÄ·ÖÎö²Ù×÷£¬ÐèÒªÏȽ«Æäת»»Îª×Ö·û´®¡£
ÓÃlocationÀ´½øÐд¦Àí£¬Ê×ÏȽ«Æäת»»Îª×Ö·û´®£¬Óú¯ÊýtoString()£¬URL.toString();
¸½Ò»Ð©URL²ÎÊý
ÍêÕûµÄURLÓÉÕ⼸¸ö²¿·Ö¹¹³É£º
scheme://host:port/path?query#fragment
scheme = ͨÐÅЭÒé (³£ÓõÄhttp,ftp,maitoµÈ)
host = Ö÷»ú (ÓòÃû»òIP)
port = ¶Ë¿ÚºÅ
path = ·¾¶
query = ²éѯ
¿ÉÑ¡£¬ÓÃÓÚ¸ø¶¯Ì¬ÍøÒ³£¨ÈçʹÓÃCGI¡¢ISAPI¡¢PHP/JSP/ASP/ASP.NETµÈ¼¼ÊõÖÆ×÷µÄÍøÒ³£©´«µÝ²ÎÊý£¬¿ÉÓжà¸ö²ÎÊý£¬ÓÔ&”·ûºÅ¸ô¿ª£¬Ã¿¸ö²ÎÊýµÄÃûºÍÖµÓÔ=”·ûºÅ¸ô¿ª¡£
fragment = ÐÅϢƬ¶Ï
×Ö·û´®£¬ÓÃÓÚÖ¸¶¨ÍøÂç×ÊÔ´ÖеÄƬ¶Ï¡£ÀýÈçÒ»¸öÍøÒ³ÖÐÓжà¸öÃû´Ê½âÊÍ£¬¿ÉʹÓÃfragmentÖ±½Ó¶¨Î»µ½Ä³Ò»Ãû´Ê½âÊÍ¡£(Ò²³ÆΪêµã.)
¶ÔÓÚÕâÑùÒ»¸öURL
http://www.master8.net:80/seo/?ver=1.0&id=6#imhere
ÎÒÃÇ¿ÉÒÔÓÃjavascript»ñµÃÆäÖеĸ÷¸ö²¿·Ö
1, window.location.href
Õû¸öURl×Ö·û´®(ÔÚä¯ÀÀÆ÷ÖоÍÊÇÍêÕûµÄµØÖ·À¸)
2,window.location.protocol
URL ......
×ܼǼÊý:2244; ×ÜÒ³Êý:374; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [16] [17] [18] [19] 20 [21] [22] [23] [24] [25]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ