JavaScriptÖÐWindow.eventÏê½â
event´ú±íʼþµÄ״̬£¬ÀýÈç´¥·¢event¶ÔÏóµÄÔªËØ¡¢Êó±êµÄλÖü°×´Ì¬¡¢°´ÏµļüµÈµÈ¡£
event¶ÔÏóÖ»ÔÚʼþ·¢ÉúµÄ¹ý³ÌÖвÅÓÐЧ¡£
eventµÄijЩÊôÐÔÖ»¶ÔÌض¨µÄʼþÓÐÒâÒå¡£±ÈÈ磬fromElement ºÍ toElement ÊôÐÔÖ»¶Ô onmouseover ºÍ onmouseout ʼþÓÐÒâÒå¡£
Àý×Ó
ÏÂÃæµÄÀý×Ó¼ì²éÊó±êÊÇ·ñÔÚÁ´½ÓÉϵ¥»÷£¬²¢ÇÒ£¬Èç¹ûshift¼ü±»°´Ï£¬¾ÍÈ¡ÏûÁ´½ÓµÄÌøת¡£
<HTML>
<HEAD><TITLE>Cancels Links</TITLE>
<SCRIPT LANGUAGE="JScript">
function cancelLink() {
if (window.event.srcElement.tagName == "A" && window.event.shiftKey)
window.event.returnValue = false;
}
</SCRIPT>
<BODY onclick="cancelLink()">
ÏÂÃæµÄÀý×ÓÔÚ״̬À¸ÉÏÏÔʾÊó±êµÄµ±Ç°Î»Öá£
<BODY onmousemove="window.status = 'X=' + window.event.x + ' Y=' + window.event.y">
ÊôÐÔ£º
altKey, button, cancelBubble, clientX, clientY, ctrlKey, fromElement, keyCode, offsetX, offsetY, propertyName, returnValue, screenX, screenY, shiftKey, srcElement, srcFilter, toElement, type, x, y
--------------------------------------------------------------------------------
1.altKey
ÃèÊö£º
¼ì²éalt¼üµÄ״̬¡£
Óï·¨£º
event.altKey
¿ÉÄܵÄÖµ£º
µ±alt¼ü°´ÏÂʱ£¬ÖµÎª TRUE £¬·ñÔòΪ FALSE ¡£Ö»¶Á¡£
2.button
ÃèÊö£º
¼ì²é°´ÏµÄÊó±ê¼ü¡£
Óï·¨£º
event.button
¿ÉÄܵÄÖµ£º
0 û°´¼ü
1 °´×ó¼ü
2 °´ÓÒ¼ü
3 °´×óÓÒ¼ü
4 °´Öмä¼ü
5 °´×ó¼üºÍÖмä¼ü
6 °´ÓÒ¼üºÍÖмä¼ü
7 °´ËùÓеļü
Õâ¸öÊôÐÔ½öÓÃÓÚonmousedown, onmouseup, ºÍ onmousemove ʼþ¡£¶ÔÆäËûʼþ£¬²»¹ÜÊó±ê״̬ÈçºÎ£¬¶¼·µ»Ø 0£¨±ÈÈçonclick£©¡£
3.cancelBubble
ÃèÊö£º
¼ì²âÊÇ·ñ½ÓÊÜÉϲãÔªËصÄʼþµÄ¿ØÖÆ¡£
Óï·¨£º
event.cancelBubble[ = cancelBubble]
¿ÉÄܵÄÖµ£º
ÕâÊÇÒ»¸ö¿É¶ÁдµÄ²¼¶ûÖµ:
TRUE ²»±»ÉϲãÔËصÄʼþ¿ØÖÆ¡£
FALSE ÔÊÐí±»ÉϲãÔªËصÄʼþ¿ØÖÆ¡£ÕâÊÇĬÈÏÖµ¡£
Àý×Ó£º
ÏÂÃæµÄ´úÂëƬ¶ÏÑÝʾÁ˵±ÔÚͼƬÉϵã»÷£¨onclick£©Ê±£¬Èç¹ûͬʱshift¼üÒ²±»°´Ï£¬¾ÍÈ¡ÏûÉϲãÔªËØ£¨body£©ÉϵÄʼþonclickËùÒý·¢µÄshowSrc()º¯Êý¡£
<SCRIPT LANGUAGE="JScript">
function checkCancel() {
if (window.event.shiftKey)
window.event.cancelBubble = true;
}
function showSrc() {
if (window.event.srcEl
Ïà¹ØÎĵµ£º
eval(str)
ÓÃÀ´´«ÈëÒ»¸ö×Ö·û´®¶¯Ì¬Ö´ÐÐÒ»¶Î½Å±¾£¬Õâ¸ö·½·¨·Ç³£ÓÐÓᣵ±Ö±½ÓÓÃeval()ʱ£¬×÷ÓÃÓòΪµ±Ç°×÷ÓÃÓò£¬ÓÐʱºòÎÒÃÇÐèÒªÈÃËüÔÚÈ«¾Ö×÷ÓÃÓò·¶Î§ÄÚÖ´ÐУ¬±ÈÈç
ajax·µ»ØµÄ½Å±¾×Ö·û´®£¬È»¶øä¯ÀÀÆ÷¶ÔevalµÄ²îÒì¿ÉÄÜʹÊÂÇé¸Õ¿ªÊ¼²¢²»ÊÇÄÇô˳Àû£¬±¾ÎÄͨ¹ýÔÚ7ÖÖä¯ÀÀÆ÷(IE, Firefox,
Chrome, Safari, Opera£©»·¾³Öвâ ......
http://blog.csdn.net/cyai/archive/2009/05/25/4213956.aspx
JS×Ô´øº¯Êý
concat
½«Á½¸ö»ò¶à¸ö×Ö·ûµÄÎı¾×éºÏÆðÀ´£¬·µ»ØÒ»¸öеÄ×Ö·û´®¡£
var a = "hello";
var b = ",world";
var c = a.concat(b);
alert(c);
//c = "hello,world"
indexOf
·µ»Ø×Ö·û´®ÖÐÒ»¸ö×Ó´®µÚÒ»´¦³öÏÖµÄË÷Òý£¨´Ó×óµ½ÓÒËÑË÷£©¡£Èç¹ûÃ»Ó ......
ÆäËüÃæÏò¶ÔÏóµÄÓïÑÔÈçJAVAµÄÒ»¸ö³£¼ûÌØÐÔÊÇ£¬¸ù¾Ý´«ÈëµÄ²»Í¬ÊýÁ¿»òÀàÐ͵ģ¬Í¨¹ýÖØÔØ(overload) À´·¢»Ó²»Í¬µÄ¹¦Ó᣾¡¹ÜÕâ¸öÌØÐÔÔÚJavaScriptÖв¢Ã»ÓÐÖ±½ÓÖ§³Ö£¬Ò²Óкܶà°ì·¨Äܹ»ÊµÏÖ¡£
º¯ÊýÖØÔØ£¨function overloading£©±ØÐëÒÀÀµÁ½¼þÊÂÇ飺Åжϴ«Èë²ÎÊýµÄÊýÁ¿µÄÄÜÁ¦ºÍÅжϴ«Èë²ÎÊýÀàÐ͵ÄÄÜÁ¦¡£
JavaScript掅 ......
×÷Õß:
YITU.org
À´Ô´:
YITU.org
ʱ¼ä:
2007-02-26 10:34:58
ÓÐʱÎÒÃÇÐèÒªÔÚ¿Í»§¶Ë»ñÈ¡Á´½Ó²ÎÊý£¬Ò»¸ö³£¼ûµÄ·½·¨Êǽ«Á´½Óµ±×ö×Ö·û´®£¬°´ÕÕÁ´½ÓµÄ¸ñʽ·Ö½â£¬È»ºó»ñÈ¡¶ÔÓ¦µÄ²ÎÊýÖµ¡£±¾Îĸø³öµÄ¾ÍÊÇÕâ¸öÁ÷³ÌµÄ¾ßÌåʵÏÖ·½·¨¡£
µ±È»£¬ ......
null, undefined
Ïàͬ£º
µ±Ò»¸ö±äÁ¿µÄÖµÊÇnull, undefinedʱ£¬±íʾ£ºÎÒÃÇÉùÃ÷²¢¶¨ÒåÁËÒ»¸ö±äÁ¿£¬½ö½öÊÇÕâ¸ö±äÁ¿µÄÖµÊÇnull, undefined.
±»µ÷ÓÃÕߣº
½«null, undefined×÷Ϊ²ÎÊý´«Èë"JavaScriptÄÚÖú¯Êý"ʱ£¬²»»á³öÏÖÒì³££¬ÄÚÖú¯Êý·µ»Ø£ºnull -> null, undefined->undefined
µ«typeofº¯Êý³ýÍâ¡£
µ÷ ......