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

JavaScriptµÄÁíÍâÁ½Öּ̳лúÖÆ

1>zInherit£º
      ËüÊÇÒ»¸ö×é¼þ£¬ÓÃÀ´¼Ì³Ð»ùÀàµÄËùÓÐÊôÐԺͷ½·¨¡£¸úÒÔǰ˵µ½µÄÔ­ÐÍÁ´Ä£Ê½·Ç³£ÀàËÆ£¬Ö»²»¹ý±ÈÔ­Ð͸ü°²È«£¬Ò²ÎÞÐ뿼ÂDzÎÊýÎÊÌâ¡£ÏÂÃæ¿´¿´zInheritµÄÓ÷¨£º
      ¸Ã×é¼þÖÐÖ»ÓÐÁ½¸ö·½·¨£ºinheritfrom() instanceof()
     function Polygon(iSides){
this.iSides = iSides;
if(typeof Polygon._initialized == "undefined"){
Polygon.prototype.getArea = function(){
return 0;
}
Polygon._initialized = true;
}
}
function Traingle(iHeight,iWidth){
Polygon.call(this,3);
this.iHeight = iHeight;
this.iWidth = iWidth;
if(typeof Traingle._initialized == "undefined"){
Traingle.inheritfrom(Polygon);
//ÉÏÐеÄЧ¹û¸úÔ­À´µÄÕâ¸ö·Ç³£ÀàËÆ
// Traingle.prototype = new Polygon();
Traingle.prototype.getArea = function(){
return 0.5*iHeight*iWidth;
}
Traingle._initialized = true;
}
}
var traingle = new Traingle(12,4);
alert(traingle.getArea());//24
    Note:ÔÚÖ´ÐÐÇ°±ØÐë¼ÓÔØzInherit.js
2>xbObjects.js
    ËüÊÇÒ»¸ö¹¦ÄܸüÇ¿´óµÄ¼Ì³Ð»úÖÆ£¬³ýÁË¿ÉÒԼ̳лùÀàµÄÊôÐԺͷ½·¨Í⣬»¹¿ÉÒÔµ÷Óø¸ÀàµÄ·½·¨£¬ÔÚÖ´ÐÐÇ°Ò³±ØÐëÔö¼Ó×é¼þxbObject.js.
 ¾ßÌåµÄ²½ÖèÈçÏ£º
   µÚÒ»²½£º×¢²áÀࣨ_classes.registerClass("sub_class","base_class") _classes.register("sub_class")£©
   µÚ¶þ²½£º¹¹Ô캯Êý£¬²¢ÔÚº¯ÊýÖж¨ÒåÀà(_classes.defineClass("class_name",prototypeFunction))
   µÚÈý²½£ºÖ´ÐÐinit£¨£©·½·¨£¬¸Ã·½·¨µÄ²ÎÊý±ØÐë¸ú¹¹Ô캯ÊýµÄ²ÎÊýÆ¥Åä
   µÚËIJ½£º¿ÉÒÔͨ¹ýparentMehtod("method_name",arguments)
   <mce:script type="text/javascript"><!--
//Polygon
_classes.registerClass("Polygon"); //1
function Polygon(iSides){ //2
_classes.defineClass("Polygon",prototypeFunction);
this.init(iSides);//³õʼ»¯PolygonµÄËùÓÐÊôÐÔ//3

function prototypeFunction(){//4
Polygon.prototype.init = function(iSides){
this.parentMethod("init");
this.iSides


Ïà¹ØÎĵµ£º

JavaScriptÖÐ µÄµ¹¼Æʱ

<html>
<head>
<title></title>
</head>
<body>
<form id=aa name=aa>
<input type=button value="ͬÒâ(10)" id=a1 disabled="disabled">
</form>
</body>
</html>
<script>
var num=10;
window.setTimeout("aa()",1000);
function ......

JavascriptÔõôÔÚÁ½¸ö´°ÌåÖ®¼ä´«Öµ2

Ô­ÎÄ£ºÁõÎä|JavascriptÔõôÔÚÁ½¸ö´°ÌåÖ®¼ä´«Öµ2-showModalDialog  
ǰһƪÎÄÕÂJavascriptÔõôÔÚÁ½¸ö´°ÌåÖ®¼ä´«ÖµÖн²µ½ÁËÈçºÎÀûÓÃwindow.open()·½·¨´ò¿ªÐ´°Ì壬²¢ÔÚÁ½¸ö´°ÌåÖ®¼ä´«ÖµµÄ·½·¨¡£javascriptÖл¹ÓÐÒ»¸öº¯Êýwindow.showModalDialogÒ²¿ÉÒÔ´ò¿ªÒ»¸öд°Ì壬²»¹ýËû´ò¿ªµÄÊÇÒ»¸öģ̬´°¿Ú£¬ÄÇôÈçºÎÔÚ¸¸´°Ì ......

ÓÃJavascript¶¨Î»ÔªËØλÖÃÈ«¹¥ÂÔ


¼ÙÉè obj Ϊij¸ö HTML ¿Ø¼þ¡£
obj.offsetTop Ö¸ obj ¾àÀëÉÏ·½»òÉϲã¿Ø¼þµÄλÖã¬ÕûÐÍ£¬µ¥Î»ÏñËØ¡£
obj.offsetLeft Ö¸ obj ¾àÀë×ó·½»òÉϲã¿Ø¼þµÄλÖã¬ÕûÐÍ£¬µ¥Î»ÏñËØ¡£
obj.offsetWidth Ö¸ obj ¿Ø¼þ×ÔÉíµÄ¿í¶È£¬ÕûÐÍ£¬µ¥Î»ÏñËØ¡£
obj.offsetHeight Ö¸ obj ¿Ø¼þ×ÔÉíµÄ¸ß¶È£¬ÕûÐÍ£¬µ¥Î»ÏñËØ¡£
ÎÒÃǶÔÇ°ÃæÌáµ½µÄ“ ......

JavaScriptÄÚÖöÔÏóÊôÐÔ¼°·½·¨´óÈ«


1.Date
ÊôÐÔ(1):
constructor      Ëù½¨Á¢¶ÔÏóµÄº¯Êý²Î¿¼
prototype       Äܹ»Îª¶ÔÏó¼ÓÈëµÄÊôÐԺͷ½·¨
·½·¨(43):
getDay()        ·µ»ØÒ»ÖÜÖеĵڼ¸Ìì(0-6)
getYear()       ·µ»ØÄê·Ý.2000ÄêÒÔǰΪ2λ,2000 ......

IEºÍFirefoxÔÚcss,JavaScript·½ÃæµÄ¼æÈÝÐÔ

1.document.formName.item("itemName") ÎÊÌâ
˵Ã÷:IEÏÂ,¿ÉÒÔʹÓÃdocument.formName.item("itemName")»òdocument.formName.elements["elementName"];FirefoxÏÂ,Ö»ÄÜʹÓÃdocument.formName.elements["elementName"].
½â¾ö·½·¨:ͳһʹÓÃdocument.formName.elements["elementName"].
2.¼¯ºÏÀà¶ÔÏóÎÊÌâ
˵Ã÷:IEÏÂ,¿ÉÒÔʹÓÃ() ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ