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Á˽ⲻÊÇÌرðÉîÈëµÄ»°,ºÜÈÝÒ׾ͻáд³ö²»¼æÈݵĴúÂë(¾ÍÏñÎÒ),Õâʱºò¾ÍµÃÅжÏä¯ÀÀÆ÷ÁË¡£±ÈÈçʼþÕìÌý¡¢Ò»Ð©Êó±êºÍ¼üÅÌʼþ¡¢RangeµÈ,һЩ¶¼»á²»Ò»Ñù.ÏÂÃæÁгö¼¸ÖÖ³£Óõļì²âä¯ÀÀÆ÷·½·¨£¬ÒÔ÷ϹÛÖÚ!
¶ÔÏó/ÌØÕ÷¼ì²â·¨
¸Ã·½·¨ÊÇÒ»ÖÖÅжÏä¯ÀÀÆ÷ÄÜÁ¦£¨¶ø·Çä¯ÀÀÆ÷µÄÈ·ÇÐÐͺţ©µÄͨÓ÷½·¨¡£´ó²¿·ÖJSר¼ÒÈÏΪÕâ¸ö·½· ......
javascriptÖÐreplace()
ÔÚjavascriptÖУ¬StringµÄº¯Êýreplace()¼òֱ̫ÈÃÈËϲ°®ÁË¡£ËüÁé»î¶øÇ¿´óµÄ×Ö·ûÌæ»»´¦ÀíÄÜÁ¦£¬ÈÃÎÒ²»½ûÏëÏò´ó¼Ò½éÉÜËü¡£
¡¡¡¡replace()×î¼òµ¥µÄËãÊÇÄÜÁ¦¾ÍÊǼòµ¥µÄ×Ö·ûÌæ»»¡£Ê¾Àý´úÂëÈçÏ£º
<script language="javascript">
var strM = "javascript is a good script ......
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>¹¹Ô캯Êý´´½¨¶ÔÏó ......
Ò»¡¢ÉùÃ÷×Ö·û´®:
var normal_monkey = "I am a monkey!<br>";
document.writeln("Normal monkey " + normal_monkey);
var bold_monkey = normal_monkey.bold();
document.writeln("Bold monkey "&n ......