Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Javascript: onresize

ä¯ÀÀÆ÷£ºIE 8¡¢FF 3.6¡¢Chrome 4.0¡¢Safari 4.0¡¢Opera 10.1
½öÓÐIEä¯ÀÀÆ÷Ö§³ÖHTMLElement.onresize£¨±ÈÈçbody.onresize£©
ÆäËüä¯ÀÀÆ÷Ö»Ö§³Öwindow.onresize
ÏÈ˵IEµÄHTMLElement.onresize
ʹÓÃÇ°ÇëÈ·¶¨ÄãµÄÐÄÔ༰ѪѹÕý³££¬Èç¹ûÄ㶨ÒåÁË
body.onresize = function(){……}»òÕßhtml.onresize = obj.fun;
Äã²Â²ÂthisÖ¸ÕëÊÇË­£¿²»ÊÇbody£¬²»ÊÇhtml£¬²»ÊÇobj£¬¶øÊÇwindow£¡
ÕâÑùÇå¿öÏÂÈç¹û£º
function fun(){
……
};
html.onresize = fun;
body.onresize = fun;
document.getElementById("id").onresize = fun;
ÒÔÉÏ´úÂëÍêÈ«¿ÉÓã¬Ö»ÊÇfunÖ´ÐÐʱ£¬Äã¸ù±¾²»ÖªµÀÊÇÄĸöÔªËؼ¤·¢µÄ¡£Ê²Ã´£¿Äã˵event¶ÔÏñÀï»á²»»áÓм¤·¢µÄÔªËØ£¿¿Ï¶¨µÄ˵£ºÃ»ÓУ¡
ºÃÁË£¬ÎÒÃÇ·ÅÇáËÉ£¬Ã»°ì·¨¾Íû°ì·¨°É¡£´ó²»ÁËÎҾͲ»¹ÜÊÇË­¼¤·¢µÄÈ«¶¼´¦ÀíÒ»±é¡£²»¹ý»¹ÊÇÏÈ¿´ÏÂÃæµÄ´úÂ룺
function addresize(element){
element.onresize = function(){
……
};
};
addresize(body);
addresize(html);
addresize(#id);
Äã²Â²ÂÔÚonresizeÖ´ÐÐʱµÄthisÊÇË­£¿±ðÏëÁË£¬»¹ÊÇwindow£¡
ÁéÒìµÄÊÂÇé·¢ÉúÁË£¬ÔÚÊ¡ÂԺŵĴúÂëÖÐÄã¿ÉÒÔʹÓÃelement±äÁ¿£¡Ò²¾ÍÊÇaddresizeµÄ²ÎÊý£¬Õâ¸ö²ÎÊýÊÇʼþ¼¤·¢ÔªËØ¡£
ΪÕâ¸öÊÂÎÒÔÎÁ˺ü¸Ì죬µ½ÏÖÔÚ¶¼Ã»ÏëÃ÷°×Õâ¸öÓï·¨¹æÔò£¬µ±×÷Ò»¸öÌØÊâÓ÷¨°É¡£
ÏÂÃæ˵window.onresize
ÔÚIEÖÐÕâ¸öʼþºÜºÃÓ㬵±´°¿ÚÈÝÁ¿´óС·¢Éú±ä»¯Ê±¾Í»á¼¤·¢£¡£¨×¢ÒâºÚÌå×Ö£©
ÔÚÆäËüä¯ÀÀÆ÷ÖоÍÓÐÎÊÌâÁË£¬Ëü½öÔÚ´°¿Ú´óС·¢Éú±ä»¯Ê±¼¤·¢¡£
ÕâÀï¾ÍÓÐÇø±ðÁË£º
µ±ÎÒÏëÈÃij¸öÔªËسäÂúÕû¸ö´°¿Ú£¬ÕâÑùµÄ»°ÔÚwindow.onresizeʱ¾ÍÐèÒª¸Ä±äËüµÄstyle.width/height
ÔÚIEÖÐûÓÐÈκÎÎÊÌ⣬ÆäËüÓÎÀÀÆ÷ÔÚËõСʱ¾Í³öÏÖÎÊÌâÁË£º
Õû¸öʼþµÄÁ÷³ÌÊÇÕâ¸öÑù×ӵģº
1¡¢window¸Ä±ä´óС£¬ÕâÀïÌØÖ¸ËõС¡£
2¡¢ä¯ÀÀÆ÷·¢ÏÖÈÝÄɲ»ÏÂÄÚÈÝ£¬¸øhtmlÌí¼ÓÁ˹ö¶¯Ìõ£¬¿ÉÊÓÇøÓò¸üСÁË¡£
3¡¢ä¯ÀÀÆ÷¼¤·¢ÁËwindow.onresizeʼþ´úÂë¡£ÄãÔÚÕâÀï¸ü¸ÄÁËÔªËصĴóС¡£
4¡¢ä¯ÀÀÆ÷·¢ÏÖ¿ÉÒÔÈÝÄÉÏÂÄÚÈÝÁË£¬È¡ÏûÁ˹ö¶¯Ìõ¡£
5¡¢IEÔÚ´ËʱÔٴμ¤·¢onresize¡¢ÆäËüä¯ÀÀÆ÷ÂÔ¹ý´Ë²½
Õâʱ³ýIEÍ⣬ÄãµÄÔªËØ»áÉÙÒ»¸ö¹ö¶¯ÌõµÄ´óС¡£
½â¾ö·½°¸£º
³ýÁËIEÖ®ÍâµÄä¯ÀÀÆ÷ÇëÁ¬ÐøÉèÖÃÁ½´Î´óС¡£Ã¿´Î¶¼ÊÇÈ¡body.client/offset´óС¾ÍÐÐÁË¡£


Ïà¹ØÎĵµ£º

ÓÃJavaScriptʵÏÖ¸ü¸´ÔӵĽ»»¥ [9]

Ò»¡¢Ê²Ã´ÊÇ¿ò¼Ü
¡¡¡¡¿ò¼ÜFrames×îÖ÷Òª¹¦ÓÃÊÇ"·Ö¸î"ÊÓ´°£¬Ê¹Ã¿¸ö"СÊÓ´°"ÄÜ
ÏÔʾ²»Í¬µÄHTM
LÎļþ£¬²»Í¬¿ò¼ÜÖ®¼ä¿ÉÒÔ»¥¶¯(interact)£¬Õâ¾ÍÊÇ˵²»Í¬¿ò¼ÜÖ®¼ä¿ÉÒÔ½»»»Ñ¶Ï¢Óë×ÊÁÏ¡£ÀýÈç:¼ÙÉèÄú¿ªÁËÁ½¸öframes£¬µÚÒ»¸öframe¿ÉÏÔ
ʾÊéµÄĿ¼£¬µÚ¶þ¸öframeÔòÏÔʾÕ½ڵľßÌåÄÚÈÝ¡£
¡¡¡¡¿ò¼Ü¿ÉÒÔ½«ÆÁÄ»·Ö¸î ......

javascript±Ê¼Ç

¶¨Òå±äÁ¿
var test=10;
ʹÓöÔÏóÊôÐÔ
¿ÉÒÔʹÓà . ²Ù×÷·û»ñµÃÊôÐÔ,Ò²¿ÉÒÔʹÓÃÊý×éϱê»ñµÃ,±ÈÈç
for(var prop in document)
document.write(document[prop]+"<br>");
With ÉùÃ÷¶ÔÏó,Ö®ºóÔÙÓõ½¶ÔÏó¾Í²»±ØÉùÃ÷ÁË
with(document){
write("Hello World<br>±êÌâ: ");
write(title);
}
³£ÓöÔÏó ......

¡¾ÍƼö¡¿Ê®¸ö¿ªÔ´µÄJavascript¿ò¼Ü


 
ÏÂÃæÊÇÊ®¸ö×îÅ£µÄÒ²ÊÇ×îÁ÷ÐеÄJavascript¿ò¼Ü¡£ËüÃÇÍêÈ«¿ÉÒÔµ£ÈÎÄ¿Ç°ÊÀ½çÉϼ¸ºõËùÓÐһЩºÍAjax¼¼ÊõÏà¹ØµÄºÍͼÐνçÃæÏà¹ØµÄÒ»Çй¦ÄÜ¡£
jQuery
http://jquery.com/
Èç¹û½ñÌìÄ㻹²»ÖªµÀjQueryµÄ»°£¬ÄÇô×÷Ϊһ¸ö³ÌÐòÔ±Äã¿ÉÄÜÕæµÄÊÇ´Ó»ðÐÇÀ´µÄÁË¡£Õâ¿ÖÅÂÊÇAjaxÖÐÓ¦ÓÃ×î¹ãµÄ¿ò¼Ü¡£°üÀ¨ÁËÐí¶àºÜ²»´íµÄUI×é¼þ£¬×ö³öÍø ......

ÓÐ¹Ø JavaScript µÄ 10 ¼þÈÃÈ˷ѽâµÄÊÂÇé

JavaScript ¿ÉËãÊÇÊÀ½çÉÏ×îÁ÷Ðеıà³ÌÓïÑÔ£¬ËüÔø±» Web ¿ª·¢Éè¼ÆʦÌùÉÏجÃεıêÇ©£¬ËäÈ»ÕæÕýµÄجÃÎÆäʵÊÇ DOM
API£¬Õâ¸ö±»´óÁ¿µÄ¿ª·¢ÓëÉè¼ÆʦËæÊÖÄéÀ´ÔöÇ¿ËûÃÇµÄ Web Ç°¶ËµÄ½Å±¾ÓïÑÔ£¬Èç½ñÔ½À´Ô½±»ÖØÊÓ£¬ËäÔòÈç´Ë£¬JavaScript
ÈÔȻӵÓкܶàÈÃÈ˷ѽâµÄ¶«Î÷¡£
1. ËüÒÔ Java ÃüÃû£¬µ«²¢²»ÊÇ Java
Ëü×î³õ½Ð Mocha£¬ ½Óן ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ