Javascript¼òÒ×¼ÆÊ±Æ÷£¨ÓÃÀ´¼ÇËã´úÂëµÄÖ´ÐÐʱ¼ä£©
×Ô¼ºÐ´µÄÒ»¸ö¼òÒ×¼ÆÊ±Æ÷£¬ÄܼÇËã´úÂëµÄÖ´ÐÐʱ¼ä£¬»¹¿ÉÒÔÄÃÀ´²âÊÔ´úÂëµÄÖ´ÐÐЧÂÊ¡£
function Counter(){
this.start();
}
Counter.prototype.getTime = function(){
var time = new Date();
return time.getSeconds()*1000+time.getMilliseconds();
}
Counter.prototype.start = function(){
this.counting = true;
this.startTime = this.getTime();
}
Counter.prototype.stop = function(){
if(this.counting == true){
this.counting = false;
this.stopTime = this.getTime();
}
}
Counter.prototype.show = function(){
this.counting==true && this.stop();
this.time = this.stopTime-this.startTime;
document.write('Ö´ÐдúÂ뻨·ÑÁË '+this.time+' ºÁÃë<br>');
this.start();
}
ʹÓÃʾÀýÈçÏ£º
var myCounter = new Counter();
for(var i=0;i<500;i++){
document.write('|');
}
myCounter.show();
var myCounter2 = new Counter();
document.write('<br>');
myCounter2.start(); //ÖØÐ¿ªÊ¼¼ÆÊ±
for(var i=0;i<500;i++){
document.write('*');
}
myCounter2.stop(); //Í£Ö¹¼ÆÊ±
for(var i=0;i<500;i++){
document.write(';');
}
myCounter2.show(); //ÕâÀïÏÔʾµÄʱ¼äÊÇÖ´ÐеÚÒ»´ÎforÑ»·ËùÓõÄʱ¼ä(¾ÍÊÇÊä³öÒ»ÅÅ*µÄÄǸö)
ÔÚ´´½¨¶ÔÏóºó»á×Ô¶¯¿ªÊ¼¼ÆÊ±¡£
µ÷ÓöÔÏóµÄstart()·½·¨½«ÖØÐ¿ªÊ¼¼ÆÊ±¡£
µ÷ÓÃstop()·½·¨»áÍ£Ö¹¼ÆÊ±¡£
show()·½·¨ÓÃÀ´ÏÔʾ´úÂëÖ´ÐеÄʱ¼ä£¨Èç¹ûµ÷ÓÃshow()·½·¨Ç°Ã»Óе÷Óùýstop()£¬»á×Ô¶¯µ÷ÓÃÒ»´Î£©
¶à¸ö¼ÆÊ±¶ÔÏóÖ®¼ä»¥²»Ó°Ïì¡£
ÒòΪÎÒ»¹ÊǸö²ËÄñ£¬Ï£Íû´ó¼Ò¶ÔÎҵIJ»×ãÖ®´¦µãÆÀÖ¸Õý£¡
Ïà¹ØÎĵµ£º
±¾ÎÄÖ÷ÒªÊdzöÓÚÓÐÅóÓÑʹÓÃÎÒÔÀ´Ð´µÄautocompleteµÄJS¿Ø¼þ¡£µ±Êý¾ÝÁ¿´óµÄʱºò£¬»á³öÏÖЧÂʼ«ÆäÂýµÄÇé¿ö£¬ÎÒÔÚÕâ¶Îʱ¼ä×ö³öµÄһЩ²âÊÔÒ²¼°Ò»Ð©¾Ñ飬Óë´ó¼Ò·ÖÏí£¬Èç¹ûÓдíµÄµØ·½£¬»¹ÇëÖ¸³ö¡£
¾¹ý²âÊÔ£¬ÎÒÃǻᷢÏÖÈçϵÄÇé¿ö»òÕß˵µÄ½áÂÛ£¬Èç¹ûÄúµÄ²âÊÔ½á¹ûÓëÎҵIJ»·û£¬Çë˵Ã÷ÔÒò£¬ÒÔ±ãÏ໥ѧϰ¡£
1£©µ±Ò»¸ö½Ï´óµÄHTML×Ö· ......
×î½ü̫æ,ûÓÐʱ¼ä×ܽṤ×÷ÄÚÈÝÁË,æÀï͵ÏаÉ,¹²ÏíÏÂÎÒµÄJavaScript MD5 ½Å±¾
var hex_chr = "0123456789abcdef";
function rhex(num)
{
str = "";
for(j = 0; j <= 3; j++)
str += hex_chr.charAt((num >> (j * 8 + 4)) & 0x0F) +
hex_chr.charAt((num >> (j * 8)) & 0x0F);
re ......
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 ......
//1.Àà
function Test(id)
{
this.id=id;
this.method=function()
{
//´úÂë
};
}
......
¡¡½éÉÜÔõÑù½â¾öJavaScriptÒ³ÃæË¢ÐÂÓ뵯³ö´°¿ÚµÄÎÊÌâ¡£
¡¡¡¡1.ÎÞÌáʾˢÐÂÍøÒ³
¡¡¡¡´ó¼ÒÓÐûÓз¢ÏÖ£¬ÓÐÐ©ÍøÒ³£¬Ë¢ÐµÄʱºò£¬»áµ¯³öÒ»¸öÌáʾ´°¿Ú£¬µã“È·¶¨”²Å»áˢС£
¡¡¡¡¶øÓеÄÒ³Ãæ²»»áÌáʾ£¬²»µ¯³öÌáʾ´°¿Ú£¬Ö±½Ó¾ÍË¢ÐÂÁË.
¡¡¡¡Èç¹ûÒ³ÃæÃ»ÓÐform£¬Ôò²»»áµ¯³öÌáʾ´°¿Ú¡£Èç¹ûÒ³ÃæÓÐform±íµ¥£¬
¡¡¡¡a)< fo ......