Javascriptʼþ¼àÌý¡¾ÕûÀí¡¿
FireFox : addEventListener()·½·¨ IE : attachEvent()·½·¨ ΪHTMLÔªËØÌí¼ÓÒ»¸öʼþ¼àÌý, ¶ø²»ÊÇÖ±½Ó¶ÔÔªËصÄʼþÊôÐÔ£¨È磺onclick¡¢onmouseover£©¸³Öµ¡£ ÕâÁ½ÖÖ·½·¨´¦Àíʼþ»¹ÊÇÓкܴóÇø±ðµÄ£¡Ê¼þÊôÐÔÖ»Äܸ³ÖµÒ»ÖÖ·½·¨£¬¼´£º button1.onclick = function() { alert(1); };
button1.onclick = function() { alert(2); };
ÕâÑùºóÃæµÄ¸³ÖµÓï¾ä¾Í½«Ç°ÃæµÄonclickÊôÐÔ¸²¸ÇÁË¡£
Javascriptʼþ¼àÌýʾÀý
²âÊÔ
///
/// Ìí¼Óʼþ¼àÌý
///
/// ÔØÌå
/// ʼþÀàÐÍ
/// ʼþº¯Êý
function addEventHandler(target, type, func) {
if (target.addEventListener)
target.addEventListener(type, func, false);
else if (target.attachEvent)
target.attachEvent("on" + type, func);
else target["on" + type] = func;
} ///
/// ÒƳýʼþ¼àÌý
///
/// ÔØÌå
/// ʼþÀàÐÍ
/// ʼþº¯Êý
function removeEventHandler(target, type, func) {
if (target.removeEventListener)
target.removeEventListener(type, func, false);
else if (target.detachEvent)
target.detachEvent("on" + type, func);
else delete target["on" + type];
} var Button1 = document.getElementById("Button1");
var Button1Click = function() { alert(1); };
addEventHandler(Button1, "click", Button1Click);
addEventHandler(Button1, "click", function() { alert(2); } );
addEventHandler(Button1, "click", function() { alert(3); } ); removeEventHandler(Button1, "click", function() { alert(2); } ); // ÒƲ»³ö
removeEventHandler(Button1, "click", Button1Click); // ¿ÉÒÔÒƳý
¶øÌí¼Óʼþ¼àÌý¾Í¿ÉÒÔ²¢ÐС£ ÌرðÊǵ±ÍŶӺÏ×÷ʱ£¬Ê¼þ²¢Ð
Ïà¹ØÎĵµ£º
¡¾×ª×Ô¡¿http://www.cnblogs.com/chenxizhang/archive/2009/05/27/1491049.html
1. ±ê×¼µÄ·½·¨
<script type="text/javascript">
function openWin(src, width, height, showScroll){
window.showModalDialog (src,"","location:No;status:No;help:No;dialogWidth:"+width+";dialogHei ......
¡¾×ª×Ô¡¿http://www.cnblogs.com/chenxizhang/archive/2010/01/13/1646255.html
ÔÚÍøÂç±à³ÌÖУ¬ÎÒÃǾ³£ÐèÒªÓõ½javascript,ÕâЩ¿Í»§¶Ë½Å±¾ÓÖ¾³£ÐèÒªÓë·þÎñ¶Ë½øÐÐÒì²½µÄͨѶ£¬Ìá½»²¢½ÓÊÕÊý¾Ý¡£ÏÂÃæÕâ¸öÀý×ÓÑÝʾÁËÈçºÎÉè¼Æ·þÎñ£¬ÈçºÎ±àд½Å±¾
1. ·þÎñ¶Ë£¬ÕâÊÇÒ»¸öashxÎļþ
ÐèÒªÌí¼ÓÁ½¸öÒýÓà System.Runtime.Serializatio ......
¡¾×ª¡¿http://www.cnblogs.com/chenxizhang/archive/2010/01/02/1638010.html
±¾ÎÄתÔØ×Ô£ºhttp://www.cn-cuckoo.com/2007/08/01/understand-javascript-closures-72.html
Òª³ÉΪ¸ß¼¶ JavaScript ³ÌÐòÔ±£¬¾Í±ØÐëÀí½â±Õ°ü¡£
±¾ÎĽáºÏ ECMA 262 ¹æ·¶Ïê½âÁ˱հüµÄÄÚ²¿¹¤×÷»úÖÆ£¬Èà JavaScript ±à³ÌÈËÔ±¶Ô±Õ°üµÄÀí½â´Ó&ldquo ......
¡¾×ª¡¿http://www.cnblogs.com/chenxizhang/archive/2010/01/02/1638010.html
±¾ÎÄתÔØ×Ô£ºhttp://www.cn-cuckoo.com/2007/08/01/understand-javascript-closures-72.html
Òª³ÉΪ¸ß¼¶ JavaScript ³ÌÐòÔ±£¬¾Í±ØÐëÀí½â±Õ°ü¡£
±¾ÎĽáºÏ ECMA 262 ¹æ·¶Ïê½âÁ˱հüµÄÄÚ²¿¹¤×÷»úÖÆ£¬Èà JavaScript ±à³ÌÈËÔ±¶Ô±Õ°üµÄÀí½â´Ó&ldquo ......
//»ñÈ¡ä¯ÀÀÆ÷µÄ¿íºÍ¸ß£¨¶àÖÖä¯ÀÀÆ÷£©
function getNavWidthandHeightInfo()
{
var s = "";
s += " ÍøÒ³¿É¼ûÇøÓò¿í£º"+ document.body.clientWidth;
s += " ÍøÒ³¿É¼ûÇøÓò¸ß£º"+  ......