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

javascriptдÀ෽ʽ֮Îå

5¡¢Óà ¹¹Ô캯Êý+Ô­ÐÍ ¶¨ÒåÒ»¸öÀࣻͬһ¹¹Ô캯Êý¿ÉÒÔ¶¨Òå³ö¶à¸öÀàÐÍ



/**
* $define дÀ๤¾ßº¯ÊýÖ®¶þ
* @param {Object} constructor
* @param {Object} prototype
*/
function $define(constructor,prototype) {
var c = constructor || function(){};
var p = prototype || {};
return function() {
for(var atr in p)
arguments.callee.prototype[atr] = p[atr];
c.apply(this,arguments);
}
}

ÓëµÚËÄÖÖ·½Ê½ÀàËÆ£¬ÈÔÈ»Óù¹Ô캯Êý£¬Ô­ÐͶÔÏ󣬶¨ÒåÁ½¸öÀà¡£
//¹¹Ô캯Êý
function Person(name) {
this.name = name;
}
//Ô­ÐͶÔÏó
var proto = {
getName : function(){return this.name},
setName : function(name){this.name = name;}
}
//¶¨ÒåÁ½¸öÀà
var Man = $define(Person,proto);
var Woman = $define(Person,proto);
console.log(Man == Woman);//false,ͬһ¸ö¹¹Ô캯Êý£¨Person£©¶¨Ò岻ͬµÄÀà


Ïà¹ØÎĵµ£º

JavaScript ¶ÔÏóÓëÊý×é²Î¿¼´óÈ«

±¾ÎÄÁоÙÁ˸÷ÖÖJavaScript¶ÔÏóÓëÊý×é,ͬʱ°üÀ¨¶ÔÉÏÊöÿһ¶ÔÏó»òÊý×éËùÍê³É¹¤×÷µÄ¼ò¶ÌÃèÊö,ÒÔ¼°ÓëÆäÏà¹ØµÄÊôÐÔ·½·¨,ÒÔ¼°Ê¼þ´¦Àí³ÌÐò¡£
¡¡¡¡B.1 anchor¶ÔÏó
¡¡¡¡Ê¹ÓÃ<A NAME=>±ê¼Ç´´½¨µÄHTMLÃèµãÄܱ»Ò»¸öÁ´½Ó×÷ΪĿ±êÈç¹ûêµã°üÀ¨HREF=ÌØÐÔ,ÔòËüÒ²ÊÇÒ»¸öÁ´½Ó¶ÔÏó¡£
¡¡¡¡anchor¶ÔÏóÊÇdocument¶ÔÏóµÄÒ»¸öÊôÐÔ,Ëü±¾Éíà ......

javascript ÑéÖ¤´úÂëÕûÀí

//the common event,If your brower is firefox,you should use this function instead of "window.event"
function getEvent() {
if(document.all)
return window.event; //get ie event
func=getEvent.caller;
while(func!=null) {
......

javascriptÑéÖ¤2

// JScript Îļþ
/********************************************************/
/*Åж¨·µ»ØÖµÎªtrue»òfalse*/
/********************************************************/
//´ò¿ªÒ»¸öÐÂÁ´½Ó
function   openwindow()
  {
    //var $j = jQuery.noConflict();
    ......

javascript»ñÈ¡·Ö±æÂÊ,ÍøÒ³´°¿Ú´óСµÈÖµ

<html>19Â¥¿Õ¼ä,`(uqj3~9?!F
<body>
Ob*p#?L;DL0<scrīpt   LANGUAGE="Javascrīpt">
+t:{z]tbs0var s = "";19Â¥¿Õ¼äe kA3HoT1H
s += "ÍøÒ³¿É¼ûÇøÓò¿í£º" + document.body.clientWidth;19Â¥¿Õ¼äcy2if}:H/SE@
s += "<br>ÍøÒ³¿É¼ûÇøÓò¸ß£º"+ document.bo ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ