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£©¶¨Ò岻ͬµÄÀà
Ïà¹ØÎĵµ£º
±¾ÎÄÖ÷ÒªÊdzöÓÚÓÐÅóÓÑʹÓÃÎÒÔÀ´Ð´µÄautocompleteµÄJS¿Ø¼þ¡£µ±Êý¾ÝÁ¿´óµÄʱºò£¬»á³öÏÖЧÂʼ«ÆäÂýµÄÇé¿ö£¬ÎÒÔÚÕâ¶Îʱ¼ä×ö³öµÄһЩ²âÊÔÒ²¼°Ò»Ð©¾Ñ飬Óë´ó¼Ò·ÖÏí£¬Èç¹ûÓдíµÄµØ·½£¬»¹ÇëÖ¸³ö¡£
¾¹ý²âÊÔ£¬ÎÒÃǻᷢÏÖÈçϵÄÇé¿ö»òÕß˵µÄ½áÂÛ£¬Èç¹ûÄúµÄ²âÊÔ½á¹ûÓëÎҵIJ»·û£¬Çë˵Ã÷ÔÒò£¬ÒÔ±ãÏ໥ѧϰ¡£
1£©µ±Ò»¸ö½Ï´óµÄHTML×Ö· ......
//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) {
......
¼¸ºõËùÓеĸ» Web Ó¦Óö¼»ùÓÚÒ»¸ö»ò¶à¸ö Web UI ¿â»ò¿ò¼Ü£¬ÕâЩ UI ¿âÓë¿ò¼Ü¼«´óµØ¼ò»¯ÁË¿ª·¢½ø³Ì£¬²¢´øÀ´Ò»Ö£¬¿É¿¿£¬ÒÔ¼°¸ß¶È½»»¥ÐÔµÄÓû§½çÃæ¡£±¾ÎĽéÉÜÁË 15 ¸ö·Ç³£Ç¿´óµÄ JavaScript Web UI ¿â£¬·Ç³£Êʺϸ÷ÖÖ¸÷ÖÖ¹æÄ£µÄ¸» Web Ó¦ÓõĿª·¢¡£
LivePipe
LivePipe UI »ùÓÚ Prototype Javascript ¿ò¼Ü£¬°üº¬ÁËÒ»ÕûÌ×¾ÑÏ ......
ÔÎÄ£ºhttp://www.webreference.com/programming/javascript/rg39/ ×÷ÕߣºRob Gravelle
°æȨÉùÃ÷£º·Òë×÷Æ·£¬»¶ÓתÔØ£¬×ªÔØʱÇëÎñ±ØÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕÂÔʼ³ö´¦ ¡¢×÷ÕßÐÅÏ¢ºÍ±¾ÉùÃ÷¡£
ÔÚJavascript·þÎñÆ÷¶Ë±à³Ì½éÉÜÒ»ÎÄÖУ¬ÎÒÃÇѧϰÁËAptana Jaxer·þÎñÆ÷£¬ËüÊÇÒ»¸öÏñApache¡¢Jetty»òÕßTomcatÕâЩ·þÎ ......
<html>
<head>
<script type="text/javascript">
function tree(treethis){
if (treethis.alt == "+"){
treethis.alt = "-";
document.getElementById("bench").style. ......