JavaScriptʵ¼ÊÓ¦Ó㺶ԲãµÄ¿ØÖÆ
²ãµÄ¿ª·¢ÔÚʵ¼ÊÓ¦ÓÃÖбȽÏÖØÒª£¬±ÈÈçƯ¸¡¹ã¸æµÈµÈ£¬ÎÒÕâÀï¼òµ¥Ì½ÌÖһϡ£
1. ¿ØÖƲãµÄÏÔʾ»òÒþ²Ø
Á½ÖÖ°ì·¨£¬Æäʵ¶¼ÊÇ¿ØÖÆÑùʽµÄ¡£
°ì·¨Ò»£º¿ØÖÆ display ÊôÐÔ
<script language="javascript">
function show(status)
{
document.getElementById("div1").style.display = status;
}
</script>
<div id="div1" style="left:10px;top:200px;width:250;height:100;z-index:2;">
ÕâÊÇÒ»²ã,ÄÜ¿´¼ûÂð,ºÇºÇ.
</div>
<a href=# onClick="show('block');">ÏÔʾ</a>
<a href=# onClick="show('none')">¹Ø±Õ</a>
°ì·¨¶þ ¿ØÖÆ visibility ÊôÐÔ
<script language="javascript">
function show(status)
{
document.getElementById("div1").style.visibility = status;
}
<div id="div1" style="left:10px;top:200px;width:250;height:100;z-index:2;visibility=hideen;">
ÕâÊÇÒ»²ã,ÄÜ¿´¼ûÂð,ºÇºÇ.
</div>
<a href=# onClick="show('visible);">ÏÔʾ</a>
<a href=# onClick="show('hidden')">¹Ø±Õ</a>
Èç¹ûÒª¿ØÖƲ㶨ʱ¹Ø±ÕµÄ»°£¬¿ÉÒÔ¼ÓÉÏ£º
function setTimeStart()
10 {
11 window.setTimeout(hiddenTips,4000);
12 }^
</script>
ÉÏÃæ´úÂë¾ÍÊÇÀûÓÃsetTimeout·½·¨À´¿ØÖÆ4Ãëºó¹Ø±Õ²ã¡£
2. ¿ØÖƲãµÄÔ˶¯£¬ÀàËÆÓÚ¸¡¶¯¹ã¸æ
Ö÷Òª¾ÍÊÇͨ¹ý¿ØÖƲãÑùʽÖеÄtopºÍleftÊôÐÔµÄÖµÀ´Ô˶¯£¬Í¨¹ýËæ»úÉú³É²»Í¬µÄÖµ£¬¿´ÆðÀ´¾ÍÏóÔÚÔ˶¯Ò»Ñù¡£
<script language="javascript">
var a=200, b=100;
var c=0.1;
var d=5;
var t=0;
function float_1()
{
var random1 = 100*Math.random();
var random2 = 100*Math.random();
var float_1 = document.all ? document.all.float_1.style : document.float_1;
float_1.left = Math.round(a*Math.cos(t)*Math.cos(t/d)+a)+random1;
float_1.top = Math.round(b*Math.sin(t)+b)
Ïà¹ØÎĵµ£º
javascriptµ÷Óø¸´°¿ÚµÄº¯ÊýºÍ±äÁ¿
·¢²¼ÈÕÆÚ£º2008-05-28×î½ü¸üУº2008-05-28À´Ô´£ºBHCODE×÷Õߣº
web¿ª·¢µÄʱºò£¬ÓÐʱºòÐèҪʹÓÃÆäËûÒ³ÃæÉÏдºÃµÄjavasriptº¯Êý¡¢±äÁ¿¡£È絯³ö´°¿ÚÐèҪʹÓø¸´°¿ÚÖеĺ¯Êý£¬¿ò¼Ü1ÐèҪʹÓÿò¼Ü2Öеĺ¯Êý¡£
µ÷Óú¯Êý¡¢±äÁ¿µÄ·½·¨Ò»Ñù£¬¶¼ÊÇÐèÒªÊ×ÏÈ»ñµÃÄãÐèÒªµ÷Óõĺ¯ÊýËùÔÚµÄwindow¶ÔÏó ......
ÔÚjsÖУ¬Ã¿¸ö¶ÔÏó¶¼ÓÐÒ»¸öprototypeÊôÐÔ£º·µ»Ø¶ÔÏóÀàÐÍÔÐ͵ÄÒýÓ᣺ÜÞÖ¿Ú£¡Ï°Óï“ÒÀºù«»Æ°”£¬ÕâÀïµÄºù«¾ÍÊÇÔÐÍ£¬ÄÇô“Æ°.prototype” ·µ»ØµÄ¾ÍÊǺù«£¬»òÕß“Æ°.prototype= new ºù«()”¡£
prototypeµÄÓÃ;£º
¼Ì³Ð
ÓÐÒ»¸ö¶ÔÏó££×ÓÀࣺ
function ×ÓÀà() {
this.lastname = ......
·µ»Ø JavaScript È«¾Ö¶ÔÏó²Î¿¼ÊÖ²á
¶¨ÒåºÍÓ÷¨
isNaN() º¯ÊýÓÃÓÚ¼ì²éÆä²ÎÊýÊÇ·ñÊÇ·ÇÊý×ÖÖµ¡£
Óï·¨
isNaN(x)
²ÎÊýÃèÊö
x
±ØÐè¡£Òª¼ì²âµÄÖµ¡£
·µ»ØÖµ
Èç¹û x ÊÇÌØÊâµÄ·ÇÊý×ÖÖµ NaN£¨»òÕßÄܱ»×ª»»ÎªÕâÑùµÄÖµ£©£¬·µ»ØµÄÖµ¾ÍÊÇ true¡£Èç¹û x ÊÇÆäËûÖµ,Ôò·µ»Ø false¡£
˵Ã÷
isNaN() º¯Êý¿ÉÓÃÓÚÅжÏÆä²ÎÊýÊÇ·ñÊÇ NaN£ ......
//°ÑÊý¾ÝдÈëÊý¾Ý¿â
function
res(){
//»ñÈ¡ÊäÈëÖµ(mynameºÍmymailÊÇÁ½¸öÎı¾¿òµÄid)
var
uname = document.getElementById("myname"
).value;
var
umail = document.getElementById("mymail"
).value;
......
ÄãÖªµÀÊÀ½çÉÏÓжàÉÙÖÖä¯ÀÀÆ÷Â𣿳ýÁËÎÒÃÇÊìÖªµÄIE, Firefox, Opera, SafariËÄ´óä¯ÀÀÆ÷Ö®Í⣬ÊÀ½çÉÏ»¹Óнü°ÙÖÖä¯ÀÀÆ÷¡£
¼¸ÌìÇ°£¬ä¯ÀÀÆ÷¼Ò×åÓиյ®ÉúÁËһλСÍõ×Ó£¬¾ÍÊÇGoogleÍƳöµÄChromeä¯ÀÀÆ÷¡£ÓÉÓÚChrome³öÉúÃûÃÅ£¬¾¡¹ÜËû»¹ÊǸöС¼Ò»ï£¬Ã»ÓÐÈ˸ÒС ......