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

JavascriptʵÀý½Ì³Ì(8) ¼ìÑé±íµ¥ÓÐЧÐÔ

±íµ¥µÄÓÐЧÐÔ¼ìÑéÊÇjavascriptÒ»¸öºÜÓÐÓõķ½Ãæ¡£Ëü¿ÉÒÔÓÃÓÚ¼ì²éÒ»¸ö¸ø¶¨µÄ±íµ¥ÒÔ¼°·¢ÏÖ±íµ¥ÖеÄÈκÎÎÊÌ⣬±ÈÈçÒ»¸ö¿Õ°×µÄÊäÈë¿ò»òÕßÒ»¸öÎÞЧµÄE-mail£¨µç×ÓÓʼþ£©µØÖ·£¬È»ºóËü¿ÉÒÔ֪ͨÓû§²¢ÇҾͲ»»á½«ÕâЩ´íÎóµÄ±íµ¥´«¸ø·þÎñÆ÷ÒÔ½Úʡʱ¼ä¡£ÁíÍ⣬³ý´ËÒÔÍ⣬¶Ô±íµ¥±êÇ©µÄһЩÐ޸ĸúÆäËüÀàÐ͵Ľű¾ÊÇÀàËƵġ£ÒÔϵÄÀý×ÓÊÇÒ»¸ö¼òµ¥µÄ±íµ¥£¬ÈçÏÂÃæ±íµ¥Ëùʾ¡£Äã¿ÉÒÔÈÃÃû×ֵķ½¿òÁô¿Õ°×»òÕßÊäÈëÒ»¸öµç×ÓÓʼþµØÖ·¶øûÓÐ@·ûºÅ£¬¼´ÊÇÊäÈë´íÎóµÄÄÚÈÝ£¬¿´¿´JavaScriptÊǽøÐÐ±íµ¥µÄÓÐЧÐÔ¼ìÑéµÄ¡£
ÐÕÃû£º
µç×ÓÓÊÏ䣺
¡¡¡¡½á¹ûÄã¿ÉÒÔ·¢ÏÖÈç¹ûÄãÍü¼ÇÊäÈëijһÌض¨ÀàÐ͵ÄÊý¾Ýµ½±íµ¥ÖÐÈ¥£¬Ëü¾Í»á¾¯¸æÄã²¢ÇÒÈ¡ÏûÌá½»¸ø·þÎñÆ÷¡£Ö±µ½Äã¼üÈëÁËÕýÈ·µÄÐÅÏ¢£¬Ëü²Å½«±íµ¥·¢Ë͸ø·þÎñÆ÷¡£
¡¡¡¡ÏÂÃæÎÒÃÇÀ´ºÃºÃÑо¿Ò»ÏÂÔÚJavascriptÖÐÊÇÈçºÎ½øÐÐ±íµ¥µÄÓÐЧÐÔ¼ìÑéµÄ¡£ÆäÖÐÔÚ±íµ¥ÓÐЧÐÔ¼ìÑéÖÐ×îÖØÒªµÄ´úÂëÊÇÔÚ±íµ¥±êÇ©´¦µÄÒ»¸öʱ¼ä´¦ÀíÆ÷£¬Õâ¸öʱ¼ä´¦ÀíÆ÷£¨onSubmit£©±ØÐë·µ»ØÕæÖµµÄʱºò²ÅÌá½»±íµ¥¡£ÒÔÏÂÊÇÏêϸµÄ±íµ¥´úÂ룺
µ±Submit£¨Ìá½»£©°´Å¥±»°´ÏµÄʱºò£¬Õâ¸öʱ¼ä´¦ÀíÆ÷¾Í±»´¥·¢£¬Ëü½Ó×ÅÖ´Ðк¯ÊýformCheck()£¬Õâ¸öº¯ÊýÊÇÓÃÓÚ¼ì²é±íµ¥ÖÐÊÇ·ñûÓдíÎóÁË¡£
formCheck()º¯ÊýµÄ´úÂëÈçÏ£º
function formCheck()
{
if (document.theform.user_name.value == "")
{
alert("Please put in a name.");
return false;
}
if (document.theform.email.value.indexOf("@") == -1 ||
document.theform.email.value == "")
{
alert("Please include a proper email address.");
return false;
}
}
¡¡¡¡Ê×ÏÈ£¬formCheck()º¯ÊýÅжÏÊÇ·ñÓû§Ãû×ÖÊäÈëΪ¿Õ¡£Èç¹ûΪ¿Õ£¬ËüÒ²»á¾¯¸æÓû§²¢·µ»ØfalseÖµ£¬Õâ¸ö±íµ¥Ò²²»»á·¢Ë͸ø·þÎñÆ÷¡£½Ó×Å formCheck()º¯ÊýÊÇÅжÏÊÇ·ñEmailµØÖ·ÊäÈë°üº¬Ò»¸ö@·ûºÅ»òÕßÊǿյġ£Èç¹ûûÓаüº¬@·ûºÅ»òÕßÊǿյĵÄÈκÎÒ»ÖÖÇé¿ö£¬Ëü¾Í»á¾¯¸æÓû§²¢·µ»Ø falseÖµ£¬ÕâÑùÕâ¸ö±íµ¥¾Í²»»á·¢Ë͸ø·þÎñÆ÷ÁË¡£ÒÔÉϵÄÈκÎÒ»ÖÖ´íÎ󶼲»»á½«±íµ¥·¢Ë͸ø·þÎñÆ÷µÄ£¬Ö±µ½ÕýÈ·ÌîдÍêÕû¸ö±íµ¥Ö®ºó²Å½«±íµ¥·¢Ë͸ø·þÎñÆ÷¡£
¡¡¡¡ÒÔÉϳÌÐòµÄÔ­ÀíʵÖÊÊÇ»ñµÃ±íµ¥Öи÷ÔªËصÄÖµ¡°value¡±£¬È»ºó¼ÓÉÏÊÇ·ñµÈÓÚ¡°£½£½¡±Ä³Ð©É趨µÄÄÚÈÝ£¬»òÕß˵±¾Éí¹ÌÓеÄÄÚÈÝ£¨±ÈÈçEMAILµÄ£À£©¡£
¡¡¡¡°´´ËÄã¿ÉÒÔ¼ÓÒÔÀ©³äËüµÄ¹¦ÄÜ£¬±ÈÈçÍêÉÆEmailµÄ¼ìÑ鹦ÄÜ£¬¼ÓÉÏÅжϡ°£À¡±ºóµÄÓʼþ·þÎñÆ÷µÄµØÖ·ºÍÒ»µã¡°.¡±¡£ÈçÏÂͼ:


Ïà¹ØÎĵµ£º

JavaScriptÖÐÊý×é·½·¨

shift£ºÉ¾³ýÔ­Êý×éµÚÒ»Ï²¢·µ»Øɾ³ýÔªËصÄÖµ£»Èç¹ûÊý×éΪ¿ÕÔò·µ»Øundefined
var a = [1,2,3,4,5];
var b = a.shift(); //a£º[2,3,4,5]  b£º1
unshift£º½«²ÎÊýÌí¼Óµ½Ô­Êý×鿪ͷ£¬²¢·µ»ØÊý×éµÄ³¤¶È
var a = [1,2,3,4,5];
var b = a.unshift(-2,-1); //a£º[-2,-1,1,2,3,4,5]  b£º7
×¢£ºÔÚIE6.0ϲ ......

Ò»¶ÎʵÏÖHTMLÒ³ÃæÄÚ¶¨ÆÚ´¥·¢Ê¼þµÄJavaScript´úÂë

Ô­´´ÓÚ2007Äê12ÔÂ16ÈÕ£¬2009Äê10ÔÂ15ÈÕǨÒÆÖÁ´Ë¡£
JavaScriptͨ¹ýÄÚÖõÄsetTimeoutº¯ÊýÀ´Íê³ÉÒ³ÃæÄڵĶ¨Ê±¼ì²é£¬Ò²ÊǺܾÃÒÔǰдµÄ¶«Î÷ÁË¡£
Ö®ËùÒÔÏëÆðËüÀ´£¬ÊÇÒòΪÔÚºÍÏîÄ¿×éÆäËû³ÉԱ˵¸ÃÊÂÇéµÄʱºò£¬±ðÈ˾¹È»³°Ð¦ÎÒ˵ÊÇÉϸöÊÀ¼ÍµÄ´úÂ룬ÏÖÔÚ¶¼ÓÃWEB2.0ÁË¡£
<script language="JavaScript" type="text ......

Ò»¸ö´øCheckBoxµÄÊ÷ÐÎĿ¼µÄµÝ¹éËã·¨£¨javascript£©

Ô­´´ÓÚ2007Äê12ÔÂ16ÈÕ£¬2009Äê10ÔÂ15ÈÕǨÒÆÖÁ´Ë¡£
°¦£¬ºÜ¾ÃÒÔǰдµÄ´úÂ룬ɹһɹ£¬¹À¼Æ×Ô¼º¿´¶¼¿´²»¶®ÁË£¬:(
var head="display:''"
img_close=new Image()
img_close.src="/sysManage/images/f.gif"
img_open=new Image()
img_open.src="/sysManage/images/fo.gif"
img3=new Image( ......

JavaScript ¼Ì³ÐÏê½â2

 ÕâÒ»ÕÂÎÒÃǽ«»áÖصã½éÉÜJavaScriptÖм¸¸öÖØÒªµÄÊôÐÔ£¨this¡¢constructor¡¢prototype£©£¬ ÕâЩÊôÐÔ¶ÔÓÚÎÒÃÇÀí½âÈçºÎʵÏÖJavaScriptÖеÄÀàºÍ¼Ì³ÐÆð×ÅÖÁ¹ØÖØÒªµÄ×÷Óá£
this
this±íʾµ±Ç°¶ÔÏó£¬Èç¹ûÔÚÈ«¾Ö×÷Ó÷¶Î§ÄÚʹÓÃthis£¬ÔòÖ¸´úµ±Ç°Ò³Ãæ¶ÔÏówindow£» Èç¹ûÔÚº¯ÊýÖÐʹÓÃthis£¬ÔòthisÖ¸´úʲôÊǸù¾ÝÔËÐÐʱ´Ëº¯ÊýÔÚʲ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ