javascript ¸÷Öֵõ½ä¯ÀÀÆ÷¿í¶ÈºÍ¸ß¶ÈµÄº¯Êý
function getInfo()
{
var s = "";
s += " ÍøÒ³¿É¼ûÇøÓò¿í£º"+ document.body.clientWidth+"\n";
s += " ÍøÒ³¿É¼ûÇøÓò¸ß£º"+ document.body.clientHeight+"\n";
s += " ÍøÒ³¿É¼ûÇøÓò¿í£º"+ document.body.offsetWidth + " (°üÀ¨±ßÏߺ͹ö¶¯ÌõµÄ¿í)"+"\n";
s += " ÍøÒ³¿É¼ûÇøÓò¸ß£º"+ document.body.offsetHeight + " (°üÀ¨±ßÏߵĿí)"+"\n";
s += " ÍøÒ³ÕýÎÄÈ«ÎÄ¿í£º"+ document.body.scrollWidth+"\n";
s += " ÍøÒ³ÕýÎÄÈ«Îĸߣº"+ document.body.scrollHeight+"\n";
s += " ÍøÒ³±»¾íÈ¥µÄ¸ß(ff)£º"+ document.body.scrollTop+"\n";
s += " ÍøÒ³±»¾íÈ¥µÄ¸ß(ie)£º"+ document.documentElement.scrollTop+"\n";
s += " ÍøÒ³±»¾íÈ¥µÄ×ó£º"+ document.body.scrollLeft+"\n";
s += " ÍøÒ³ÕýÎIJ¿·ÖÉÏ£º"+ window.screenTop+"\n";
s += " ÍøÒ³ÕýÎIJ¿·Ö×ó£º"+ window.screenLeft+"\n";
s += " ÆÁÄ»·Ö±æÂʵĸߣº"+ window.screen.height+"\n";
s += " ÆÁÄ»·Ö±æÂÊµÄ¿í£º"+ window.screen.width+"\n";
s += " ÆÁÄ»¿ÉÓù¤×÷Çø¸ß¶È£º"+ window.screen.availHeight+"\n";
s += " ÆÁÄ»¿ÉÓù¤×÷Çø¿í¶È£º"+ window.screen.availWidth+"\n";
s += " ÄãµÄÆÁÄ»ÉèÖÃÊÇ "+ window.screen.colorDepth +" λ²ÊÉ«"+"\n";
s += " ÄãµÄÆÁÄ»ÉèÖà "+ window.screen.deviceXDPI +" ÏñËØ/Ó¢´ç"+"\n";
s += " windowµÄÒ³Ãæ¿ÉÊÓ²¿·Öʵ¼Ê¸ß¶È(ff) "+window.innerHeight+"\n"; &nbs
Ïà¹ØÎĵµ£º
¡¡javascriptº¯ÊýµÄ²ÎÊýÊÇ¿ÉÑ¡µÄ¡£ËüÓÐÏÂÃæ¼¸¸öÌØµã£º
¡¡¡¡£±.ÒòΪjavascript±¾ÉíÊÇÈõÀàÐÍ£¬ËùÒÔ£¬ËüµÄº¯Êý²ÎÊýҲûÓÐÀàÐͼì²éºÍÀàÐÍÏÞ¶¨£¬Ò»Çж¼Òª¿¿±à³ÌÕß×Ô¼ºÈ¥½øÐмì²é¡£
¡¡¡¡£².²ÎÊý¸öÊý²»¶¨¡£¾¡¹ÜÄãÒ²ÔÚÔÚº¯ÊýÉùÃ÷ʱ£¬ÓУ³¸ö²ÎÊý£¬¶øÔÚʵ¼ÊµÄʹÓÃÖУ¬Äã¿ÉÒÔ´«ÈÎÒâ¸ö²ÎÊý¸øÕâ¸öº¯Êý¡£ËüµÄʶ±ð½ö½öÊÇÒÀ¿¿º¯ÊýÃû£¬ÕâÓ ......
1>¹¤³§º¯ÊýÀ´´´½¨¶ÔÏó(Factory)
function createCar(){
var obj = new Object;
obj.name = "BWM";
obj.show = function(){
alert(this.name);
}
return obj;
}
var car1 = createCar();
var car2 = createCar();
car1.show();
car2.show();
2>¹¹Ô캯Êý´´½¨¶ÔÏó ......
"These memory leaks often
occur as a result of circular references between JavaScript objects and
objects within IE’s DOM (document object model)."
GPDE Team Blog
Ã÷ÏÔµÄDOM¶ÔÏóÓë JavaScript¶ÔÏóÑ»·ÒýÓúܺÃÅжϣ¬ÄѵÄÊÇÒþº¬µÄÑ»·ÒýÓÃÅжϣ¡
Òþº¬µÄÑ»·ÒýÓÃÐèҪͨ¹ý×÷ÓÃÓòÁ´½øÐзÖÎöÅÐ ......
Õâ¸öÎÊÌâºÜ¼òµ¥£¬Ö÷ÒªÓÐÏÂÃæ¼¸¸ö֪ʶµã£º
£¨1£© È¡µÃʱ¼ä£ºvar d=new Date();var time=d.toLocaleString()
£¨2£© ÏÔʾÔÚÍøÒ³ÉÏ£¬¼ÙÉèдÔÚÒ»¸ö<span>ÖУ¬ÇÒ¸Ã<span>µÄidΪshowTime:
document.getElementById("showTime").innerHTML ......
ÔÚÍøÉÏÕÒµ½ÔÚIEϲÙ×÷IFrameÄÚÈݵĴúÂë:
document.frames["MyIFrame"].document.getElementById("s").style.color="blue";
µ«ÊÇÕâÔÚFirefoxÏÂÎÞЧ¡£
ËùÒÔ£¬Ïëµ½ÔÚFirefoxÏÂÓÃFireBugÀ´µ÷ÊÔ¡£¾¹ýµ÷ÊÔ·¢ÏÖÔÚFirefoxÏ¿ÉÓÃÒÔÏ´úÂëÀ´ÊµÏÖ:
document.getElementById("MyIFr ......