JavaScript ¶¯»
ÎÒÃÇ¿ÉÒÔʹÓà JavaScript À´´´½¨¶¯Ì¬µÄͼÏñ¡£
ʵÀý
°´Å¥¶¯»
ÀûÓÃÁ½¸ö²»Í¬µÄʼþÀ´Çý¶¯Á½¸öÏàÓ¦µÄº¯Êý£¬À´Çл»Á½ÕŶÔÓ¦µÄͼƬÒÔ´´Ôì³ö¶¯»Ð§¹û¡£
JavaScript ¶¯»
ʹÓà JavaScript ´´½¨¶¯Ì¬Í¼ÏñÊÇ¿ÉÐеġ£
ÇÏÃÅ
ÊÇ£ºÊ¹Óà JavaScript ͨ¹ý²»Í¬µÄʼþÀ´Çл»²»Í¬µÄͼÏñ¡£
ÔÚÏÂÃæµÄÀý×ÓÖУ¬ÎÒÃÇÒªÖÆ×÷Ò»¸ö³äµ±Á´½Ó°´Å¥µÄͼÏñ¡£ÎÒÃǽ«Ê¹Óà onMouseOver ʼþºÍ onMouseOut ʼþÀ´Çý¶¯ JavaScript º¯ÊýÇл»Í¼Ïñ¡£
HTML ´úÂë
ÕâÊÇ HTML ´úÂ룺
<a href="http://www.w3school.com.cn" target="_blank">
<img border="0" alt="Visit W3School!"
src="/i/eg_mouse2.jpg" name="b1"
onmouseOver="mouseOver()"
onmouseOut="mouseOut()" />
</a>
×¢Òâ
£ºÎÒÃÇÒÑΪͼÏñÌí¼ÓÁË name ÊôÐÔ£¬ÕâÑù JavaScript ¾ÍÄÜÕÒµ½ËüÁË¡£
onMouseOver ʼþµÄ×÷ÓÃÊǸæÖªä¯ÀÀÆ÷£ºÒ»µ©Êó±êÐü¸¡ÓÚͼÏñÖ®ÉÏ£¬ä¯ÀÀÆ÷¾Í»áÖ´ÐÐij¸öº¯Êý£¬Õâ¸öº¯Êý»á°ÑÕ⸱ͼÏñÌ滻ΪÁíÒ»·ù¡£
onMouseOut ʼþµÄ×÷ÓÃÊǸæÖªä¯ÀÀÆ÷£ºÒ»µ©Êó±êÀ뿪ͼÏñ£¬ä¯ÀÀÆ÷¾ÍÒªÖ´ÐÐÁíÒ»¸öº¯Êý£¬Õâ¸öº¯Êý»áÖØвåÈëÔÀ´µÄÄÇ·ùͼÏñ¡£
JavaScript ´úÂë
ͨ¹ýÏÂÃæµÄ´úÂëÀ´Çл»Í¼Ïñ£º
<script type="text/javascript">
function mouseOver()
{
document.b1.src ="/i/eg_mouse.jpg"
}
function mouseOut()
{
document.b1.src ="/i/eg_mouse2.jpg"
}
</script>
º¯Êý mouseOver() ½«Í¼ÏñÇл»Îª "eg_mouse.jpg"¡£
º¯Êý mouseOut() ½«Í¼ÏñÇл»Îª "eg_mouse2.jpg"¡£
ÍêÕûµÄ´úÂ룺
<html>
<head>
<script type="text/javascript">
function mouseOver()
{
document.b1.src ="/i/eg_mouse.jpg
"
}
function mouseOut()
{
document.b1.src ="/i/eg_mouse2.jpg
"
}
</script>
</head>
<body>
<a href="http://www.w3school.com.cn" target="_blank">
<img border="0" alt="Visit W3School!" src="/i/eg_mouse2.jpg" name="b1"
onmouseOver="mouseOver()"
onmouseOut="mouseOut()"
/>
</a>
</body>
</h
Ïà¹ØÎĵµ£º
JavaScriptʹÓ÷½·¨ºÍ¼¼ÇÉ´óÈ«
ÓÐЩʱºòÄ㾫ͨһÃÅÓïÑÔ£¬µ«ÊǻᷢÏÖÄãÆäʵÕûÌìÔÚºÍÆäËüÓïÑÔ´ò½»µÀ£¬Ò²ÐíÄãÒÔΪÕâЩ΢²»×ãµÀ£¬²»ÖÁÓÚÓ°ÏìÄãµÄ¿ª·¢½ø¶È£¬µ«Ç¡Ç¡ÊÇÕâЩÄã²»ÖØÊӵĶ«Î÷»áÀË·ÑÄãºÜ¶àʱ¼ä£¬ÎÒÒ»Ö±ÒÔΪÎÒÔçÔÚ¼¸ÄêÇ°¾ÍÒѾ¾«Í¨JavaScriptÁË£¬Ö±µ½Ä¿Ç°£¬ÎÒ²ÅÔ½ ......
½üÀ´¿´ÁËDeanµÄ“Convert any colour value to hex in MSIE”£¬ÖÕÓÚ½â¾öÁ˸ù¾Ý¹Ø¼ü×Ö»ñÈ¡ÑÕÉ«rgbÖµµÄÎÊÌâ¡£
˳±ã°Ñ³ÌÐòÒ²ÖØÐÂÕûÀíÒ»·¬£¬²¢Ê¹ÓÃÁË×î½üÕûÀíµÄ¹¤¾ß¿â¡£
Ч¹ûÔ¤ÀÀµ½ÕâÀï
ÏÂÔØÍêÕûʵÀý
³ÌÐò˵Ã÷
¡¾ColorGradsÑÕÉ«Ìݶȡ¿
³ÌÐòColorGradsµÄ×÷ÓÃÊǸù¾ÝÑÕÉ«¼¯ºÏºÍ½¥±ä¼¶ÊýÉú³ÉÑÕÉ«Ìݶȼ¯ºÏ¡£
½¥±ä¼ ......
JavascriptÖÐ×î³£ÓõÄ55¸ö¾µä¼¼ÇÉ ÊÕ²Ø
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4 ......
function sAlert(msg,boxtype,func,msgtitle)
sAlert('ÐÅÏ¢ÄÚÈÝ',1,'','ÐÅÏ¢±êÌâ')
@msg:ÌáʾÐÅÏ¢ÄÚÈÝ
@boxtype£º1Ϊµ¯³ö¿ò£¬2ΪȷÈÏ¿ò£¬3ΪÌáʾ¿ò
@func:µãÈ·ÈÏʱִÐеĺ¯Êý
@title:ÐÅÏ¢¿ò±êÌâÎÄ×ÖÄÚÈÝ
Ö»ÓÐmsgÊDZØÐëµÄ£¬ºóÃæµÄ²ÎÊý¿ÉÒÔÊ¡ÂÔ¡£Èç¹ûÖмäµÄ²ÎÊýΪ¿ÕÔòÔÚ¶ÔӦλÖÃÉÏ''»òÕß""±íʾ£¨¸ù¾Ýʵ¼ÊÇé¿öÑ¡Ôñµ ......
javascript¶¨Òå¶þάÊý×éµÄ·½·¨ javascript±¾ÉíÖ»Ö§³ÖһάÊý×飬
ÓÐʱ·ÇÒªÓõ½¶þάÊý×éµÄʱºò£¬ ¿ÉÒÔ½«Ò»Î¬Êý×éµÄ·ÖÏîÓÖ¶¨ÒåΪһ¸öÊý×飬 ¶þάÊý×é¾ÍÊÇÓÃÊý×é¹¹³ÉµÄÊý×é
Var aa=new Array(); //¶¨ÒåһάÊý×é
for(i=1;i<=10;i++)
{
aa[i]=new Array(); //½«Ã¿Ò»¸ö×ÓÔªËØÓÖ¶¨ÒåΪÊý ......