Ï꾡½âÎö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.srcElement.tagName == "IMG")
alert(window.event.srcElement.src);
}
</S
Ïà¹ØÎĵµ£º
var currItem = listbox.options[currIndex];
var prevItem = listbox.options[currIndex - 1];
&n ......
1£© Ϊʲô¼ÓÔØjavascriptÎļþºÜÖØÒª£¿
javascriptÎļþÊDZȽÏÌØÊâµÄ£¬ÒòΪä¯ÀÀÆ÷¼ÓÔØjavascriptÊÇ´®Ðеġ£ÒÔΪ×ÅÔÚ¼ÓÔØJavascriptÎļþµÄʱºò£¬ÆäËûÒ»ÇÐ×ÊÔ´µÄÏÂÔØ°üÀ¨Ò³ÃæµÄÏÔʾ¶¼»á±»×èÈû¡£
2£© ÈçºÎÕýÈ·µÄ¼ÓÔØJavaScript£¿
a. ½«JavaScriptÎļþ·ÅÔÚÒ³ÃæµÄ×îºó
ÒòΪJavaScriptµÄ¼ÓÔØ»á×èÈûÒ³ÃæµÄÏÔʾ£¬ËùÒÔ½«JavaScrip ......
ƽʱÎÒÃÇÓпÉÄÜÓöµ½ÐèÒª°ÑÍøÕ¾ÖеÄÊý×Ö£¨Í¨³£ÊǼ۸ñ£©ÓÃÒ»ÖÖͳһµÄ·½Ê½ÏÔʾ³öÀ´£¬±ÈÈçÿ¸ô3¸ö×Ö·û¼ÓÒ»¸ö¿Õ¸ñ¡£Èç¹ûÊýÖµ±È½Ï´óµÄ»°ÕâÖÖ·½·¨ºÜÓÐÀûÓÚÓû§ÔĶÁ¡£
ÓÃXSLTµÄÅóÓÑ¿ÉÄÜÖªµÀÔÚXSLÖпÉÒÔÓÃÈçÏ´úÂëʵÏÖ
<xsl:decimal-format name="currency" decimal-separator="." grouping-separator=" "/>
½ñÌìÑо¿ÁËһϠ......
Ò»¡¢Ä¬ÈϺ¯Êý
JavaScriptÌṩÁËһЩĬÈϵĺ¯Êý
±àÂ뺯Êýescape()£º½«·Ç×Öĸ¡¢Êý×Ö×Ö·ûת»»³ÉASCIIÂë
ÒëÂ뺯Êýunescape()£º½«ASCIIÂëת»»³É×Öĸ¡¢Êý×Ö×Ö·û
ÇóÖµº¯Êýeval()
ÊýÖµÅжϺ¯ÊýisNaN()£ºÅжÏÒ»¸öÖµÊÇ·ñΪ·ÇÊýÖµÀàÐÍ
ÕûÊýת»»º¯ÊýparseInt()£º½«²»Í¬½øÖÆ£¨¶þ¡¢°Ë¡¢Ê®Áù½øÖÆ£©µÄÊýֵת»»³ÉÊ®½øÖ ......
//¼ò·±×ª»»¹¦ÄÜ
// ½«Ö¸¶¨ÔªËØÖеÄÎı¾×ª»»Îª¼òÌå
function bodytojt(x)
{
var bodys=document.getElementById(x);
bodys.innerHTML=Simplized(bodys.innerHTML);
}
// ½«Ö¸¶¨ÔªËØÖеÄÎı¾×ª»»Îª·±Ìå
function bodytoft(x)
{
var bodys=document.getElementById(x);
bodys.innerHTML=Traditionalized(bodys.in ......