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

JavascriptÖеÄÀûÓÃÔ­ÐÎÁ´ºÍ¶ÔÏóð³ä´´½¨Àà

¿´µ½Ò»¸öÔø¾­¸ã¹ýwebµÄÈ˵ÄblogÖÐ˵µ½Èç¹ûѧJavascript²»¶®Ô­ÐÎÁ´£¬¾ÍÌ«Òź¶ÁË£¬ËùÒÔµ±×Ô¼º¿´¡¶javascript¸ß¼¶³ÌÐòÉè¼Æ¡·Ê±¾ÍÁôÒâÁËһϣ¬ËµÊµ»°£¬ÏÂÃæµÄ´úÂëºÜ¼òµ¥£¬µ«ÊDz»ÊǺܶ®ËùνµÄÔ­ÐÎÁ´ºÍ¶ÔÏóð³äÖ®ÀàµÄ¶«Î÷ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head>
<meta content="text/html; charset=gb2312" http-equiv="Content-Type" />
<title>¼Ì³Ð»úÖƵÄʵÏÖ--ʵÀý</title>
<script type="text/javascript">
   function Polygon(iSides){
    this.sides=iSides;
   }
   Polygon.prototype.getArea=function(){
    return 0;
   };
    function Triangle(iBase,iHeight){
    Polygon.call(this,3);
    this.base=iBase;//ÉèÖûù±¾µÄ±ßÊý
    this.height=iHeight;
   }
     Triangle.prototype=new Polygon();
     Triangle.prototype.getArea=function(){
     return 0.5*this.base*this.height;
     };
     function Rectangle(iWidth,iHeight){
     Polygon.call(this,4);
     this.width=iWidth;
     this.height=iHeight;
     }
     Rectangle.prototype=new Polygon();
     Rectangle.prototype.getArea=function(){
     return this.width*this.height;
     };
     var triangle=new Triangle(12,4);
     var rectangle=new Rectangle(22,10);
     alert("Èý½ÇÐεıß


Ïà¹ØÎĵµ£º

JavaScriptÖжÔÏóµÄ´´½¨

JavaScriptÖд´½¨¶ÔÏóµÄ·½·¨ÈçÏ£º
Ò»¡¢´´½¨¼òµ¥¶ÔÏó£º
×î¼òµ¥µÄ´´½¨¶ÔÏóµÄ·½·¨¾ÍÊÇÓÃÒ»¸öеÄObject£¬È»ºóÏòÆäÖÐÌí¼ÓÄÚÈÝ£º
 
ÏÖÔÚµ÷ÓÃmyObject.say(),½«µ¯³ö’gao’µÄ¾¯¸æ¿ò¡£
 
var myObject = new Object();
myObject.name = ‘gao’;
myObject.say = function(){
alert ......

javascript µÄtry catch


Try...Catch Óï¾ä
try...catch ¿ÉÒÔ²âÊÔ´úÂëÖеĴíÎó¡£try ²¿·Ö°üº¬ÐèÒªÔËÐеĴúÂ룬¶ø catch ²¿·Ö°üº¬´íÎó·¢ÉúʱÔËÐеĴúÂë¡£
Óï·¨£º
try
{
//ÔÚ´ËÔËÐдúÂë
}
catch(err)
{
//ÔÚ´Ë´¦Àí´íÎó
}
×¢Ò⣺
try...catch ʹÓÃСд×Öĸ¡£´óд×Öĸ»á³ö´í¡£
ʵÀý 1
ÏÂÃæµÄÀý×ÓÔ­±¾ÓÃÔÚÓû§µã»÷°´Å¥Ê±ÏÔʾ " ......

ÄÇЩÏà¼ûºÞÍíµÄ JavaScript ¼¼ÇÉ£¨×ªÔØ£©

JavaScript µÄ³É¹¦ÈÃÈ˽ò½òÀÖµÀ£¬Îª Web ÍøÒ³±àд JavaScript ´úÂëÒѾ­ÊÇËùÓÐ Web Éè¼ÆʦµÄ»ù±¾¹¦£¬ÕâÃÅÓÐȤµÄÓïÑÔÔ̲Ø×ÅÐí¶à²»ÎªÈËÊìÖªµÄ¶«Î÷£¬¼´Ê¹¶àÄêµÄ JavaScript ³ÌÐòÔ±£¬Ò²Î´ÄÜÍêÈ«³Ô͸¡£±¾ÎÄ´Ó7¸ö·½Ãæ½²Êö JavaScript ÖÐÄÇЩÄã²»ºÜÊìÖªµ«·Ç³£ÊµÓõļ¼ÇÉ¡£
¼òÂÔÓï¾ä
JavaScript ¿ÉÒÔʹÓüòÂÔÓï¾ä¿ìËÙ´´½¨¶ÔÏóºÍÊý× ......

javascript ×Ô¶¨Òå¶ÔÏóµÄ¼¸ÖÖ·½Ê½ºÍ×¢Òâµã

¶ÔÏó³õʼ»¯·½Ê½(Ò²½Ðjson¶ÔÏó´´½¨·½Ê½)
<script type="text/javascript">
   var User = {
       name:"centerqi",
       age:25,
       toString:function()
    ......

JavaScriptɾ³ýÊý×éÖÐÖ¸¶¨ÖµµÄÔªËØ

/* ·½·¨:Array.remove(dx)
* ¹¦ÄÜ:ɾ³ýÊý×éÔªËØ.
* ²ÎÊý:dxɾ³ýÔªËصÄϱê.
* ·µ»Ø:ÔÚÔ­Êý×éÉÏÐÞ¸ÄÊý×é
*/
//¾­³£ÓõÄÊÇͨ¹ý±éÀú,Öع¹Êý×é.
Array.prototype.remove=function(dx)
{
if(isNaN(dx)||dx>this.length){return false;}
for(var i=0,n=0;i<this.length;i++)
{
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ