Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Javascriptº¯ÊýºÍʼþ

 
Ò»¡¢Ä¬ÈϺ¯Êý
JavaScriptÌṩÁËһЩĬÈϵĺ¯Êý
 
±àÂ뺯Êýescape()£º½«·Ç×Öĸ¡¢Êý×Ö×Ö·ûת»»³ÉASCIIÂë
ÒëÂ뺯Êýunescape()£º½«ASCIIÂëת»»³É×Öĸ¡¢Êý×Ö×Ö·û
ÇóÖµº¯Êýeval()
ÊýÖµÅжϺ¯ÊýisNaN()£ºÅжÏÒ»¸öÖµÊÇ·ñΪ·ÇÊýÖµÀàÐÍ
ÕûÊýת»»º¯ÊýparseInt()£º½«²»Í¬½øÖÆ£¨¶þ¡¢°Ë¡¢Ê®Áù½øÖÆ£©µÄÊýֵת»»³ÉÊ®½øÖÆÕûÊý
¸¡µãÊýת»»º¯ÊýparseFloat()£º½«ÊýÖµ×Ö´®×ª»»³É¸¡µãÊý
1¡¢eval()º¯Êý
ÇóÖµº¯Êýeval()µÄ¸ñʽΪ£ºeval(<±í´ïʽ>)
ÏÂÃæµÄÀý×Ó½«ÓÃevalº¯ÊýµÃµ½Ò»¸öÎı¾¿òµÄÖµ£¬
È»ºóͨ¹ýµã»÷°´Å¥µ¯³öÒ»¸ö¶Ô»°¿ò½«ÆäÊä³ö¡£
<script>
function show(obj)
{
    var str=eval("document.Form."+obj+".value");
    alert(“ÄãÊäÈëµÄÐÕÃûÊÇ:”+str);
}
</script>
<form name="Form" id="Form">
    ÐÕÃû£º
    <input name="name" type="text" value="ΤС±¦">
   <input name="button" type="button" value="Ìá½»" onClick=show("name")>
</form>
 
2¡¢isNaN()º¯Êý
ÊýÖµÅжϺ¯ÊýisNaN()µÄ¸ñʽ£ºisNaN(<Á¿>)
 
       ÏÂÀýÖÐisNaNº¯Êý½«ÅжϱäÁ¿ÊÇ·ñ²»ÊÇÊýÖµ£¬²¢Êä³öÅжϽá¹û¡£
<script>
    var x=15;
    var y="»ÆÑÅÁá";
    document.write("<LI>x²»ÊÇÊýÖµÂð£¿",isNaN(x));
    document.write("<LI>y²»ÊÇÊýÖµÂð£¿",isNaN(y));
</script>
3¡¢parseInt()º¯Êý
       ÕûÊýת»»º¯ÊýparseInt()µÄ¹¦ÄÜÊǽ«²»Í¬½øÖÆ£¨¶þ¡¢°Ë¡¢Ê®Áù£©µÄÊýֵת»»³ÉÊ®½øÖÆÕûÊý¡£
       ¸ñʽ£ºparseInt(ÊýÖµ×Ö´®[£¬µ×Êý])
       ÏÂÃæÑÝʾÁ˽«Ò»¸ö¶þ½øÖÆÊýºÍÒ»¸öÊ®Áù½øÖÆÊýת»»³ÉÊ®½øÖÆÊý¡£
 
<script>
    document.write("1101<sub>2</sub>=",parseInt("1101",2),"<sub>10</sub><br>");
    document.write("BFFF<sub>16</sub>=",parseInt("BFFF",16),"<sub>10</sub><br>");
</script>
4¡¢parseFloat()º¯Êý
parseFloat()ÊǸ¡µãÊý


Ïà¹ØÎĵµ£º

JavaScript »ñÈ¡¶ÔÏóµÄ¸ß¶ÈºÍ¿í¶ÈÏêϸ˵Ã÷

scrollHeight: »ñÈ¡¶ÔÏóµÄ¹ö¶¯¸ß¶È¡£
scrollLeft:ÉèÖûò»ñȡλÓÚ¶ÔÏó×ó±ß½çºÍ´°¿ÚÖÐÄ¿Ç°¿É¼ûÄÚÈݵÄ×î×ó¶ËÖ®¼äµÄ¾àÀë
scrollTop:ÉèÖûò»ñȡλÓÚ¶ÔÏó×¶ËºÍ´°¿ÚÖпɼûÄÚÈݵÄ×¶ËÖ®¼äµÄ¾àÀë
scrollWidth:»ñÈ¡¶ÔÏóµÄ¹ö¶¯¿í¶È
offsetHeight:»ñÈ¡¶ÔÏóÏà¶ÔÓÚ°æÃæ»òÓɸ¸×ø±ê offsetParent ÊôÐÔÖ¸¶¨µÄ¸¸×ø±êµÄ¸ß¶È
offsetL ......

javascript call

javaScript
ÖÐµÄ call
() ÊÇÒ»¸öÆæÃîµÄ·½·¨£¬µ«Ò²ÊÇÒ»¸öÈÃÈËÃÔ»óµÄ·½·¨£¬ÏÈ¿´Ò»Ï¹ٷ½µÄ½âÊÍ£º
call
·½·¨
Çë²ÎÔÄ
Ó¦ÓÃÓÚ£ºFunction ¶ÔÏó
񻂗
°æ±¾ 5.5
µ÷ÓÃÒ»¸ö¶ÔÏóµÄÒ»¸ö·½·¨£¬ÒÔÁíÒ»¸ö¶ÔÏóÌæ»»µ±Ç°¶ÔÏó¡£
call
([thisObj[,arg1[, arg2[,   [,.argN]]]]])
²ÎÊý
thisObj
¿ÉÑ¡Ïî¡£½«±»ÓÃ×÷µ±Ç ......

JavaScriptʹÓü¼Çɾ«ÝÍ

(Ò»).È·ÈÏɾ³ýÓ÷¨:
  1. BtnDel.Attributes.Add("onclick","return confirm('"+"È·ÈÏɾ³ý?"+"')");
  2. linktempDelete.Attributes["onclick"]="javascript:return  confirm('"+"È·ÈÏɾ³ý?"+"');";
  3. privat ......

JavaScript·½·¨ºÍ¼¼ÇÉ´óÈ«

             JavaScript·½·¨ºÍ¼¼ÇÉ´óÈ«
1£º»ù´¡ÖªÊ¶
1 ´´½¨½Å±¾¿é
1: <script language=”JavaScript”>
2: JavaScript code goes here
3: </script>
2 Òþ²Ø½Å±¾´úÂë
1: <script language=”JavaScript”>
2: ......

javascript¶¯Ì¬Ìí¼Ó/ɾ³ýdiv


Ìí¼Ó
<script>
var oDiv = document.createElement("DIV");
oDiv.id = "shop01";
oDiv.style.top = 200;
oDiv.style.left = 200;
oDiv.style.background = '#FFFF00';
oDiv.style.visibility = 'visible';
oDiv.innerHTML="123123"
document.body.appendChild(oDiv ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ