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/01/1637309.html
Èç¹ûÎÒÃÇÐèÒªÔÚjavascript·ÃÎʵ½Ò³ÃæÖж¨ÒåµÄ±äÁ¿£¬´óÖÂÊÇÈçϵÄÓï·¨
//ÕâÊÇ2010Äê1ÔÂ1ÈÕÔö¼ÓµÄ´úÂë
var ismanager = "<%= DepartManager %>";
if (ismanager == "true") {
$(" ......
JavaScriptΪº¯Êý¶ÔÏó¶¨ÒåÁËÁ½¸ö·½·¨£ºapplyºÍcall£¬ËüÃǵÄ×÷Óö¼Êǽ«º¯Êý°ó¶¨µ½ÁíÍâÒ»¸ö¶ÔÏóÉÏÈ¥ÔËÐУ¬Á½Õß½öÔÚ¶¨Òå²ÎÊýµÄ·½Ê½ÓÐËùÇø±ð£º
Function.prototype.apply(thisArg,argArray);
Function.prototype.call(thisArg[,arg1[,arg2…]]);
´Óº¯ÊýÔÐÍ¿ÉÒÔ¿´µ½£¬µÚÒ»¸ö²ÎÊý¶¼±»È¡ÃûΪthisArg£¬¼´ËùÓк¯ÊýÄÚ²¿µ ......
½ñÌìAJAX±ØÐëÓÃJS£¬×öÇ°¶Ë±ØÐëÓÃJS£¬ÓÉÓڿγ̽ô£¬Ö»°²ÅÅÁËÒ»Ììʱ¼ä£¬Ö»½²ÁËDom¡£ DOM ¿ÉÔÚJ2SEAPIËÑDocument£¬±ã¿ÉÒԲ鿴·½·¨ DOMÊ÷:½Úµã£¨node£©µÄ²ã´Î¡£ ½Úµã·ÖΪÈýÖÖÀàÐÍ£º ½Úµã£¨node£©£ºÀ´Ô´ÓÚÍøÂçÀíÂÛ£¬´ú±íÍøÂçÖеÄÒ»¸öÁ¬½Óµã¡£ÍøÂçÊÇÓɽڵ㹹³ÉµÄ¼¯ºÏ 1.½Úµã·ÖΪÈýÖÖÀàÐÍ£º
element node attribute node ......