javascriptдÀ෽ʽ֮ʮ
10¡¢mootools.jsµÄдÀ෽ʽ
mootools.jsµÄ×îа汾ÊÇ1.2.3,ÕâÀïʹÓõÄÊÇ1.2.0¡£mootool±»Éè¼Æ³É·Ç³£½ô´ÕµÄ£¬Ä£¿é»¯µÄ£¬ÃæÏò¶ÔÏóµÄµÄjs¿â¡£mootoolÖÐдÀàÓÃClassÀà¡£ClassÀàÓÉNativeÀànew³öÀ´µÄ£º
/*
*Script: Class.js
*/
var Class = new Native({
name: 'Class',
initialize: function(properties){
properties = properties || {};
var klass = function(empty){
for (var key in this) this[key] = $unlink(this[key]);
for (var mutator in Class.Mutators){
if (!this[mutator]) continue;
Class.Mutators[mutator](this, this[mutator]);
delete this[mutator];
}
this.constructor = klass;
if (empty === $empty) return this;
var self = (this.initialize) ? this.initialize.apply(this, arguments) : this;
if (this.options && this.options.initialize) this.options.initialize.call(this);
return self;
};
$extend(klass, this);
klass.constructor = Class;
klass.prototype = properties;
return klass;
}
});
Native·½·¨ÊÇmootoolsÖÐÒ»¸ö·Ç³£ÖØÒªµÄ·½·¨£¬ºÜ¶àÀà¶¼ÓÃËüÈ¥×é×°¡£ÈçWindow,Document,Event¡£µ±È»»¹ÓÐÕâÀïµÄClass£¬µ¼ÈëmootoolsºóÎÒÃÇдÀàʱֻÐèÒªÓÃClass¾ÍÐÐÁË¡£Ò»¸öPersonÀࣺ
/**
* PersonÀà
* @param {Object} name
*/
var Person = new Class({
initialize: function(name){
this.name = name;
},
setName : function(name) {
this.name = name;
},
getName : function() {
return this.name;
}
})
//newÒ»¸ö¶ÔÏó
var p = new Person("jack");
//²âÊÔset£¬get·½·¨
console.log(p.getName());//jac
p.setName('andy');
console.log(p.getName());//andy
//²âÊÔinstanceof¼°p.constructorÊÇ·ñÕýÈ·Ö¸ÏòÁËPerson
console.log(p instanceof Person); //true
console.log(p.constructor == Person); //true
Nativeʵ¼ÊÉÏÖ»ÊÇÒ»¸öÆÕͨº¯Êý£¬Ëüͨ¹ýËù´«²ÎÊý×é×°ÁËÒ»¸öÀࣨfunction£©£¬×îºó·µ»Ø¸ÃÀࣨfunction£©¡£¼ÈÈ»NativeÊǺ¯Êý£¬º¯
Êýµ÷Óõķ½Ê½ÊÇ(),call,apply¡£µ«ÔÚmootoolsÖÐÈ´ÓÃnew
Native(obj)·½Ê½¡£ÎªºÎ£¿ÔÒòÖ»ÊÇʹNative¿´ÆðÀ´¸üÏñÒ»¸öÀà¶øÒÑ¡£¼û¾ßÃûº¯ÊýµÄËÄÖÖµ÷Ó÷½Ê½£¨3£©
Ïà¹ØÎĵµ£º
Ò³ÃæÌá½»Êý¾ÝÒ»°ãÓÐÁ½ÖÖ·½·¨£ºget,post¡£post¾ÍÊÇËùνµÄformÌá½»£¬Ê¹ÓÃÊÓͼ£»getÊÇͨ¹ýurlÌá½»¡£
Get·½·¨Ò»°ãÓúǫ́´úÂ루Èçasp,asp.net£©»ñµÃ²ÎÊý£¬´úÂëºÜ¼òµ¥£ºRequest.QueryString["id"];¼´¿É»ñÈ¡¡£
ÓÐЩʱºòÐèÒªÖ±½ÓÔÚǰ̨»ñÈ¡url²ÎÊý£¬ÒªÓõ½javascript£¬jsûÓÐÖ±½Ó»ñÈ¡url²ÎÊýµÄ·½·¨£¬ÄÇô£¬ÎÒÃÇÈçºÎͨ¹ýjs ......
JS Check£º
javascriptlint http://www.javascriptlint.com/index.htm
jslint http://www.jslint.com/
JS UT£º
http://www.jsunit.net/
JS ST£º
http://www.outofhanwell.com/ieleak/index.php?title=Main_Page Drip
http://blogs.msdn.com/gpde/pages/javascript-memory-leak-detector.aspx
http://blogs.msdn. ......
¼¸ºõËùÓеĸ» Web Ó¦Óö¼»ùÓÚÒ»¸ö»ò¶à¸ö Web UI ¿â»ò¿ò¼Ü£¬ÕâЩ UI
¿âÓë¿ò¼Ü¼«´óµØ¼ò»¯ÁË¿ª·¢½ø³Ì£¬²¢´øÀ´Ò»Ö£¬¿É¿¿£¬ÒÔ¼°¸ß¶È½»»¥ÐÔµÄÓû§½çÃæ¡£±¾ÎĽéÉÜÁË 15 ¸ö·Ç³£Ç¿´óµÄ JavaScript Web UI
¿â£¬·Ç³£Êʺϸ÷ÖÖ¸÷ÖÖ¹æÄ£µÄ¸» Web Ó¦ÓõĿª·¢¡£
LivePipe
LivePipe
UI
»ùÓÚ Prototype 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) {
......
Ҫȡʲôֵ£¿
È¡value£ºgetElementById("STB_433").value;
ȡ״̬£¨ÊÇ·ñcheck£©£ºgetElementById("STB_433").checked
ȡID:getElementById("STB_433").id
...
var checkboxs=document.getElementsByTagName("input");
var i;
for(i=0;i<checkboxs.length;i++)
{
if(checkboxs[i].type=='checkbox')
{ ......