¼¸ÖÖjavascriptº¯Êý¶¨ÒåµÄ²î±ð
javascriptº¯ÊýµÄ¶¨Òå
1£ºµ÷Óùؼü×ÖfunctionÀ´¹¹Ô죬È磺
function distance(x1,x2,y1,y2)
{
var dx=x2-x1;
var dy=y2-y1;
return Math.sqrt(dx*dx+dy*dy);
}
2£ºÊ¹ÓÃFunction()¹¹Ô캯Êý
var f=new Function*"x","y","return x*y");
ÕâÐдúÂë´´½¨ÁËÒ»¸öк¯Êý£¬¸Ãº¯ÊýºÍÄãËùÊìϤµÄÓï·¨¶¨ÒåµÄº¯Êý»ù±¾ÉÏʱµÈ¼ÛµÄ:
function f(x,y)
{
return x*y;
}
Functino()¹¹Ô캯Êý¿ÉÒÔ½ÓÊÜÈÎÒâ¶à¸ö×Ö·û´®²ÎÊý¡£ËüµÄ×îºóÒ»¸ö²ÎÊýʱº¯ÊýµÄÖ÷Ì壬ÆäÖпÉÒÔ°üº¬ÈκÎJavaScriptÓï¾ä£¬Óï¾äÖ®¼äÓ÷ֺŷÖ
¸ô¡£ÆäËûµÄ²ÎÊý¶¼ÊÇÓÃÀ´ËµÃ÷º¯ÊýÒª¶¨ÒåµÄÐÎʽ²ÎÊýÃûµÄ×Ö·û´®¡£Èç¹ûÄ㶨ÒåµÄº¯ÊýûÓвÎÊý£¬ÄÇô¿ÉÒÔÖ»Ðè¸ø¹¹Ô캯Êý´«µÝÒ»¸ö×Ö·û´®£¨¼´º¯ÊýµÄÖ÷Ì壩¼´¿É¡£
×¢Ò⣬´«µÝ¸ø¹¹Ô캯ÊýFunction()µÄ²ÎÊýÖÐûÓÐÒ»¸öÓÃÓÚ˵Ã÷ËüÒª´´½¨µÄº¯ÊýÃû¡£ÓÃFunction()¹¹Ô캯Êý´´½¨µÄδÃüÃûº¯ÊýÓÐʱ±»³ÉΪ“ÄäÃûº¯Êý”¡£
Äã¿ÉÄܷdz£ÏëÖªµÀFunction()¹¹Ô캯ÊýµÄÓÃ;ÊÇʲô¡£ÎªÊ²Ã´²»ÄÜÖ»ÓÃfunctionÓï¾äÀ´¶¨ÒåËùÓеĺ¯ÊýÄØ£¿ÔÒòÊÇFunction()¹¹Ô캯
ÊýÔÊÐíÎÒÃǶ¯Ì¬µØ½¨Á¢ºÍ±àÒëÒ»¸öº¯Êý£¬Ëü²»»á½«ÎÒÃÇÏÞÖÆÔÚfunctionÓï¾äÔ¤±àÒëµÄº¯ÊýÌåÖС£ÕâÑù×ö´øÀ´µÄ¸ºÃæÓ°ÏìЧӦ¾ÍÊÇÿ´Îµ÷ÓÃÒ»¸öº¯Êý
ʱ£¬Function()¹¹Ô캯Êý¶¼Òª¶ÔËü½øÐбàÒë¡£Òò´Ë£¬ÔÚÑ»·ÌåÖлòÕßÔÚ¾³£Ê¹Óõĺ¯ÊýÖУ¬ÎÒÃDz»Ó¦¸ÃƵ·±µØµ÷ÓÃÕâ¸ö¹¹Ô캯Êý¡£
ʹÓÃFunction()¹¹Ô캯ÊýµÄÁíÒ»¸öÔÒòÊÇËüÄܹ»½«º¯Êý¶¨ÒåΪJavaScript±í´ïʽµÄÒ»²¿·Ö£¬¶ø²»Êǽ«Æä¶¨ÒåÒ»¸öÓï¾ä£¬ÕâÖÖÇé¿öÏÂʹÓÃËü¾ÍÏԵñȽϵķ½Ã棬ÉõÖÁ¿ÉÒÔ˵¾«Ö¡£
3£ºº¯ÊýÖ±½ÓÁ¿
º¯ÊýÖ±½ÓÁ¿ÊÇÒ»¸ö±í´ïʽ£¬Ëü¿ÉÒÔ¶¨ÒåÄäÃûº¯Êý¡£º¯ÊýÖ±½ÓÁ¿µÄÓï·¨ºÍfunctionÓï¾ä·Ç³£ÏàËÆ£¬Ö»²»¹ýËü±»ÓÃ×÷±í´ïʽ£¬¶ø²»ÊÇÓÃ×÷Óï¾ä£¬¶øÇÒÒ²ÎÞÐèÖ¸¶¨
º¯ÊýÃû¡£ÏÂÃæµÄÈýÐдúÂë·Ö±ðʹÓÃfunction()Óï¾ä¡¢Funciont()¹¹Ô캯ÊýºÍº¯ÊýÖ±½ÓÁ¿¶¨ÒåÁËÈý¸ö»ù±¾ÉÏÏàͬ
Ïà¹ØÎĵµ£º
ת×Ô£ºhttp://www.cnblogs.com/greki/archive/2009/06/02/1494863.html
ÆäËü·½Ê½£º¹¤³§·½Ê½£¬¹¹Ô캯Êý·½Ê½£¬ÔÐÍ·½Ê½¶¼¸÷Óи÷µÄ´óȱÏÝ£¬ÕâÀï¾Í²»Ò»Ò»½éÉÜÁË£¬ÏëÁ˽âµÄ¿ÉÒÔÈ¥¿´Ò»ÏÂÕâ±¾Öø×÷µÄµÚ3Õ½ڡ£
1. »ìºÏ¹¹Ô캯Êý/ÔÐÍ·½Ê½
function Car(sColor, iDoors, iMpg) {
this .color = sColor;
this ......
JavaScriptÖÐÓÐÒÔϳ£ÓõÄʼþ£¬ËüÃÇ¿ÉÒÔͨ¹ýJavaScriptÖеÄ×Ô¶¨Ò庯ÊýÀ´ÏìÓ¦
1.onclickʼþ
µ¥»÷ʼþ£¬¼´Óû§µ¥»÷Êó±ê°´Å¥Ê±·¢ÉúµÄʼþ£¬¿ÉÒÔÔÚÒÔÏ»ù±¾¶ÔÏóÖвúÉú¸Ãʼþ£ºbutton,radio,checkbox,submit,reset
2.onchangeʼþ
¸Ä±äʼþ£¬Í¨³£·¢ÉúÔÚÒÔÏÂÁ½ÖÖÇé¿ö
& ......
<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="admin¹ÜÀíÔ±|appleÆ»¹û|allÈ«|big´ó|b ......
һ˵µ½javascript¾ÍÓÐÈË»áÏëµ½java£¬µ«ÊÇËûÃÇÍê»áÊÇÁ½»ØÊ£¬javascriptÊÇÃæÏò¶ÔÏóµÄ¶¯Ì¬ÀàÐ͵ÄÇø·Ö´óСдµÄ¿Í»§¶Ë½Å±¾ÓïÑÔ£¬Çë×¢Òâ´óСÓÐÇø±ð£¬ÃæÏò¶ÔÏó¡£javascriptÓÃ;ºÜ¶àµÄ£¬Ä¿Ç°¼¸ºõËùÓÐÖ÷Á÷ä¯ÀÀÆ÷¶¼Ö§³Ö¡£µ«ÊÇËûÓÐÒ»¸ö»µ´¦¾ÍÊDZäÁ¿£¬Èçvar
i=4;Õâ¸öi¾ÍÊÇintÀàÐ͵ģ¬var
s="hello",Õâ¸ösÊÇ×Ö·û´®ÀàÐ͵ģ ......
javascript
¶ÔÏóµÄpropertyºÍprototype
ÊÇ
ÕâÑùÒ»ÖÖ¹ØÏµ
ECMAScript¿ÉÒÔʶ±ðÁ½ÖÖÀàÐ͵ĶÔÏó£¬Ò»ÖÖ½Ð×öNative ObjectÊôÓÚÓïÑÔ·¶³ë;Ò»ÖÖ½Ð×öHost Object£¬ÓÉÔËÐл·¾³Ìá
¹©ÀýÈçdocument¶ÔÏó£¬
Dom NodeµÈ
Native objectsÊÇÒ»ÖÖËÉÉ¢µÄ½á¹¹²¢ÇÒ¿ÉÒÔ¶¯Ì¬µÄÔö¼ÓÊôÐÔ(property)£¬ËùÓеÄÊôÐÔ¶¼ÓÐÒ»¸öÃû×ÖºÍÒ»¸öÖµ£¬Õâ¸öÖµ ......