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

[ת]ÓÃJavascript»ñÈ¡Ò³ÃæÔªËصÄλÖÃ

ÓÃJavascript»ñÈ¡Ò³ÃæÔªËصÄλÖÃ
ÈîÒ»·å ·¢±íÓÚ 2009Äê09ÔÂ14ÈÕ
|
·ÖÀࣺÊ×Ò³
-> µµ°¸
-> IT¼¼Êõ


ÖÆ
×÷ÍøÒ³µÄ¹ý³ÌÖУ¬ÄãÓÐʱºòÐèÒªÖªµÀij¸öÔªËØÔÚÍøÒ³ÉϵÄÈ·ÇÐλÖá£
ÏÂÃæµÄ½Ì³Ì×ܽáÁËJavascriptÔÚÍøÒ³¶¨Î»·½ÃæµÄÏà¹Ø֪ʶ¡£
Ò»¡¢ÍøÒ³µÄ¾ø¶Ô´óСºÍÏà¶Ô´óС
Ê×ÏÈ£¬ÒªÃ÷È·Á½¸ö»ù±¾¸ÅÄî¡£
Ò»ÕÅÍøÒ³µÄÈ«²¿Ãæ»ý£¬¾ÍÊÇËüµÄ¾ø¶Ô´óС¡£Í¨³£Çé¿öÏ£¬ÍøÒ³µÄ¾ø¶Ô´óСÓÉÄÚÈݺÍCSSÑùʽ±í¾ö¶¨¡£
ÍøÒ³µÄÏà¶Ô´óСÔòÊÇÖ¸ÔÚä¯ÀÀÆ÷´°¿ÚÖп´µ½µÄÄDz¿·ÖÍøÒ³£¬Ò²¾ÍÊÇä¯ÀÀÆ÷´°¿ÚµÄ´óС£¬ÓÖ½Ð×öviewport£¨ÊÓ¿Ú£©¡£
ÏÂͼÖÐÑëµÄ·½¿ò¾Í´ú±íä¯ÀÀÆ÷´°¿Ú£¬Ã¿´ÎÖ»ÄÜÏÔʾһ²¿·ÖÍøÒ³¡£
£¨Í¼Ò» ÍøÒ³µÄ¾ø¶Ô´óСºÍÏà¶Ô´óС£©
ºÜÏÔÈ»£¬Èç¹ûÍøÒ³µÄÄÚÈÝÄܹ»ÔÚä¯ÀÀÆ÷´°¿ÚÖÐÈ«²¿ÏÔʾ£¨Ò²¾ÍÊDz»³öÏÖ¹ö¶¯Ìõ£©£¬ÄÇôÍøÒ³µÄ¾ø¶Ô´óСºÍÏà¶Ô´óСÊÇÏàµÈµÄ¡£
¶þ¡¢»ñÈ¡ÍøÒ³µÄÏà¶Ô´óС
ÍøÒ³ÉϵÄÿ¸öÔªËØ£¬¶¼ÓÐclientHeightºÍclientWidthÊôÐÔ£¬ÀûÓÃËüÃǾͿÉÒԵõ½ÍøÒ³µÄÏà¶Ô´óС¡£ÕâÁ½¸öÊôÐÔ´ú±íµÄ´óС£¬ÊÇÖ¸ÔªËصÄÄÚÈݲ¿·ÖÔÙ¼ÓÉÏpaddingµÄ´óС£¬µ«ÊDz»°üÀ¨borderºÍ¹ö¶¯ÌõÕ¼ÓõĿռ䡣
£¨Í¼¶þ clientHeightºÍclientWidthÊôÐÔ£©
Òò´Ë£¬documentÔªËصÄclientHeightºÍclientWidthÊôÐÔ£¬¾Í´ú±íÁËÍøÒ³µÄÏà¶Ô´óС¡£
¡¡¡¡function getViewport(){
¡¡¡¡¡¡¡¡if (document.compatMode == "BackCompat"){
¡¡¡¡¡¡¡¡¡¡¡¡return {
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡width: document.body.clientWidth,
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡height: document.body.clientHeight
¡¡¡¡¡¡¡¡¡¡¡¡}
¡¡¡¡¡¡¡¡} else {
¡¡¡¡¡¡¡¡¡¡¡¡return {
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡width: document.documentElement.clientWidth,
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡height: document.documentElement.clientHeight
¡¡¡¡¡¡¡¡¡¡¡¡}
¡¡¡¡¡¡¡¡}
¡¡¡¡}
ÉÏÃæµÄgetViewportº¯Êý¾Í¿ÉÒÔ·µ»Øä¯ÀÀÆ÷´°¿ÚµÄ¸ßºÍ¿í¡£Ê¹ÓõÄʱºò£¬ÓÐÈý¸öµØ·½ÐèҪעÒ⣺
1£©Õâ¸öº¯Êý±ØÐëÔÚÒ³Ãæ¼ÓÔØÍê³Éºó²ÅÄÜÔËÐУ¬·ñÔòdocument¶ÔÏó»¹Ã»Éú³É£¬ä¯ÀÀÆ÷»á±¨´í¡£
2£©´ó¶àÊýÇé¿öÏ£¬¶¼ÊÇdocument.documentElement.clientWidth·µ»ØÕýÈ·Öµ¡£µ«ÊÇ£¬ÔÚIE6µÄquirksģʽÖУ¬document.body.clientWidth·µ»ØÕýÈ·µÄÖµ£¬Òò´Ëº¯ÊýÖмÓÈëÁ˶ÔÎĵµÄ£Ê½µÄÅжϡ£
3£©clientWidthºÍclientHeight¶¼ÊÇÖ»¶ÁÊôÐÔ£¬²»ÄܶÔËüÃǸ³Öµ¡£
Èý¡¢»ñÈ¡ÍøÒ³µÄ¾ø¶Ô´óС
document¶ÔÏóµÄscrollHeightºÍscrollWidthÊôÐÔ¾ÍÊÇÍøÒ³µÄ¾ø¶Ô´óС£¬Òâ˼¾ÍÊǹö¶¯Ìõ¹ö¹ýµÄ


Ïà¹ØÎĵµ£º

JavascriptÔÚIEºÍFireFoxÖеIJ»Í¬±íÏÖ

1.document.formName.item("itemName") ÎÊÌâ
˵Ã÷:IEÏÂ,¿ÉÒÔʹÓÃdocument.formName.item("itemName")»ò
document.formName.elements["elementName"];FirefoxÏÂ,Ö»ÄÜʹÓÃ
document.formName.elements["elementName"].
½â¾ö·½·¨:ͳһʹÓÃdocument.formName.elements["elem ......

¿ªÆôJavaScriptµ÷ÊÔ

ÏÂÃæµÄ²Ù×÷²½ÖèÃèÊöÁËÔõÑùÀûÓÃvs.netÖеĵ÷ÊÔÆ÷À´µ÷ÊÔjavascript£º
1,Ê×ÏÈ£¬ÒªÈÃÄãµÄieÔÊÐíµ÷ÊԽű¾£¬¾ßÌå²½ÖèÈçÏÂ:
   ´ò¿ªie->¹¤¾ß²Ëµ¥->interÑ¡Ïî->¸ß¼¶Ñ¡Ï->È¥µô“½ûÖ¹½Å±¾µ÷ÊÔ"Ñ¡Ïî
2,´ò¿ªvs.net,´´½¨Ò»¸öеÄasp.netÏîÄ¿(»ò´ò¿ªÒ»¸ö)
3,ÔËÐÐÄãÒªµ÷ÊÔµÄÒ³Ãæ
4,µ±ÄãµÄÒ³Ãæ³ÊÏÖÔÚieÀ ......

javascript³ýÈ¥Êý×éÖеÄÖظ´ÔªËØ¡¾×ª¡¿

 function unique(data){debugger;
    data = data || [];  
       var a = {};  
    for (var i=0; i<data.length; i++) {  
        var v = data[i];  
......

href="javascript:void(0);"ÔÚIE6Öн«¶ÏÒì²½ÇëÇó

HtmlÒ³
<a href="javascript:void(0);" mce_href="javascript:void(0);" ><img id="SubmitFeedback" src="/images/comment_btn.gif" mce_src="images/comment_btn.gif" /></a>
½Å±¾
$(document).ready(function() {
alert("Ò³ÃæË¢ÐÂ&q ......

javascript framework£¬ JS³£Óú¯Êý£¨·½·¨£©£¬jQuery

//Register NameSpace for window.MSN
if(!window.MSN)
{
    window.MSN = {};
}
if(!window.MSN.SET)
{
    window.MSN.SET = {};
}
if(!window.MSN.SET.Utilities)
{
    window.MSN.Utilities = {};
}
//Check you borwse type
//IE7 &IE8 & FF et ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ