Javascript ÀàºÍÃüÃû¿Õ¼äµÄ¶¨Òå
//1.Àà
function Test(id)
{
this.id=id;
this.method=function()
{
//´úÂë
};
}
//¿ÉÒÔ¼ÌÐøÀ©Õ¹ÉÏÃæµÄ·½·¨£º
Test.prototype.method1=function(){};
//µ÷ÓÃдºÃµÄÀà var A = new Test("1");
//2.JSÃüÃû¿Õ¼ä
var namespace={};//var namespace=new Object();
o.i=4;
o.method1=function(){};
//ÎÒµÄÏë·¨ÊÇ£º¾ÍÊÇÀûÓÃobjectÌØÐÔ£¬¿ÉÒÔÌí¼Ó×Ô¼ºµÄ·½·¨ºÍ±äÁ¿£¬´Ó¶ø´ïµ½·½±ãÉèÖÃÃüÃû¿Õ¼äµÄÄ¿µÄ£»
//ÏÂÃæÊÇÍøÉϵÄÒ»¸ö·½·¨£¬ÎÒ¾õµÃÕâ¸ö±È½Ï·½±ã£¬ÌرðÊÇÃüÃû¿Õ¼äµÄ²ã´Î±È½Ï¶àµÄʱºò£¬ÓÃÕâ¸öÈ¥×¢²á£¬·Ç³£¿ì
<script language="javascript" type="text/javascript">
// Namespace
Namespace =
new
Object();
// register"Grandsoft.GEA"
Namespace.register =
function
(fullNS)
{
// N, GrandsoftGEA
var nsArray = fullNS.split('.'
);
var sEval = ""
;
var sNS = ""
;
for (var
i = 0; i < nsArray.length; i++)
{
if (i != 0) sNS += "."
;
sNS += nsArray[i];
//
// GrandsoftGrandsoft.GEA
sEval +=
"if (typeof(" + sNS + ") == 'undefined') " + sNS +
" = new Object();"
}
if (sEval != ""
) eval(sEval);
}
//JavaScript
// Grandsoft.GEA, Grandsoft.GCM
Namespace.register(
"Grandsoft.GEA"
);
Namespace.register(
"Grandsoft.GCM"
);
// Grandsoft.GEAPerson
Grandsoft.GEA.Person =
function
(name, age)
{
this
.name = name;
this
.age = age;
}
// Personshow()
Grandsoft.GEA.Person.prototype.show =
function
()
{
alert(
this.name + " is " + this.age + " years old!"
);
}
// Person
var
p = new Grandsoft.GEA.Person("yanglf"
, 25);
window.onload = p.show;
</script>
Ïà¹ØÎĵµ£º
±¾ÎÄÖ÷ÒªÊdzöÓÚÓÐÅóÓÑʹÓÃÎÒÔÀ´Ð´µÄautocompleteµÄJS¿Ø¼þ¡£µ±Êý¾ÝÁ¿´óµÄʱºò£¬»á³öÏÖЧÂʼ«ÆäÂýµÄÇé¿ö£¬ÎÒÔÚÕâ¶Îʱ¼ä×ö³öµÄһЩ²âÊÔÒ²¼°Ò»Ð©¾Ñ飬Óë´ó¼Ò·ÖÏí£¬Èç¹ûÓдíµÄµØ·½£¬»¹ÇëÖ¸³ö¡£
¾¹ý²âÊÔ£¬ÎÒÃǻᷢÏÖÈçϵÄÇé¿ö»òÕß˵µÄ½áÂÛ£¬Èç¹ûÄúµÄ²âÊÔ½á¹ûÓëÎҵIJ»·û£¬Çë˵Ã÷ÔÒò£¬ÒÔ±ãÏ໥ѧϰ¡£
1£©µ±Ò»¸ö½Ï´óµÄHTML×Ö· ......
var vKeyCode= e.getKeyCode();
if (vKeyCode >= 65 && vKeyCode <= 90 ) // Caps Lock ´ò¿ª
{
......
¼ò½é
¡¡¡¡1st JavaScript Editor ÊÇÒ»¿îÇ¿´óµÄJavaScript¿ª·¢¡¢Ð£ÑéºÍµ÷ÊÔ¹¤¾ß£¬Ëü¼òµ¥Ò×Ó㬲»ÂÛÄãÊdzõѧÕß»òÕßÊÇרҵµÄ¿ª·¢ÈËÊ¿£¬¶¼¿ÉÒÔÇáËÉÉÏÊÖ£¡Í¬Ê±ËüÓÖÊÇÍêÃÀµÄAjax (Asynchronous JavaScript and XML),CSS, HTML, DOM DHTML¿ª·¢¹¤¾ß£¡
¡¡¡¡Beside rich possibilities of editing scripts (JavaScript, ......
°æȨÉùÃ÷£ºÔ´´×÷Æ·£¬ÔÊÐíתÔØ£¬×ªÔØʱÇëÎñ±ØÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕ Ôʼ³ö´¦ ¡¢×÷ÕßÐÅÏ¢ºÍ±¾ÉùÃ÷¡£·ñÔò½«×·¾¿·¨ÂÉÔðÈΡ£http://gzycm520.blog.51cto.com/175220/36822
· ʼþÔ´¶ÔÏó event.srcElement.tagName event.srcElement.type
· ²¶»ñÊÍ·Å event.srcElement.setCapture(); ......
window
window¶ÔÏóÊÇä¯ÀÀÆ÷»òÕß¿ò¼Ü×ÔÉí.top×ÜÊÇä¯ÀÀÆ÷,parentÊǸ¸¿ò¼Ü,self±íʾ×Ô¼º.
windowͨ³£¿ÉÒÔÊ¡ÂÔ.
´°¿Ú²Ù×÷: moveBy(dx, dy), moveTo(x, y),
resizeBy(dw, dh), resizeTo(w, h).
µ¼º½: window.open(url, frame
name, attribute). attribute¿ÉÒÔÊÇleft, top, height, width, resizable,
scrollable, too ......