Ï꾡½âÎö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
Ïà¹ØÎĵµ£º
JavaScript API
One of the new features we added to the ASP.Net Report Viewer in Visual Studio 2010 is a JavaScript API to allow you to interact with the viewer on client. In reading many of the posts on the report controls forum, we found that many people struggle when implementing a custom ......
Ò»¡¢Ä¬ÈϺ¯Êý
JavaScriptÌṩÁËһЩĬÈϵĺ¯Êý
±àÂ뺯Êýescape()£º½«·Ç×Öĸ¡¢Êý×Ö×Ö·ûת»»³ÉASCIIÂë
ÒëÂ뺯Êýunescape()£º½«ASCIIÂëת»»³É×Öĸ¡¢Êý×Ö×Ö·û
ÇóÖµº¯Êýeval()
ÊýÖµÅжϺ¯ÊýisNaN()£ºÅжÏÒ»¸öÖµÊÇ·ñΪ·ÇÊýÖµÀàÐÍ
ÕûÊýת»»º¯ÊýparseInt()£º½«²»Í¬½øÖÆ£¨¶þ¡¢°Ë¡¢Ê®Áù½øÖÆ£©µÄÊýֵת»»³ÉÊ®½øÖ ......
<SCRIPT LANGUAGE="JavaScript">
<!--
// Trim() , Ltrim() , RTrim()
String.prototype.Trim = function()
{
return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.LTrim = function()
{
return this.replace(/(^\s*)/g, "");
}
String.prototype.RTrim = functio ......
SCRIPT 񈬀
ÓÃÓÚ°üº¬JavaScript´úÂë.
ÊôÐÔ
LANGUAGE ¶¨Òå½Å±¾ÓïÑÔ
SRC ¶¨ÒåÒ»¸ö
URLÓÃÒÔÖ¸¶¨ÒÔ.JS½áβµÄÎļþ
window¶ÔÏó
ÿ¸öHTMLÎĵµµÄ¶¥²ã¶ÔÏó.
ÊôÐÔ
frames[] ×ÓèåÊý×é.ÿ¸ö×ÓèåÊý×é°´Ô´ÎĵµÖж¨ÒåµÄ˳Ðò´æ
·Å.
f ......
<html>
<body>
<style>
ul,li{margin: 0; padding: 0;width:100%;}
</style>
<script language="javascript" type="text/javascript">
function checkword()
{
var wordvalue=document.getElementById("word").value.toLowerCase();
var alltxt="¹ÜÀíÔ±| ......