Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ :

Javascript ʹÓÃIDE¹¤¾ß½øÐе÷ÊÔ

1. Javascript Debug Toolkit½éÉÜ
JSDT(Javascript Debug Toolkit)ÊÇÒ»¸öÓÃÓÚjavascriptµ÷ÊÔµÄeclipse
²å¼þ£¬ÓÃÓÚµ÷ÊÔjavascript¡£JSDT¿ÉÒÔ¿çä¯ÀÀÆ÷µ÷ÊÔ£¬Ö§³ÖÔÚIE,Firefox,Safari,ChromeµÈÖ÷Á÷ä¯ÀÀÆ÷Öе÷ÊÔ
javascript¡£JSDTÖ§³ÖÉèÖöϵ㣬µ¥²½µ÷ÊԵȵ÷ÊÔ¹¤¾ßµÄ»ù±¾ÌØÐÔ¡£
2. ÈçºÎ°²×°
JSDTÊÇ»ùÓÚeclipse3.2+,jdk1.5+»ù´¡¿ª·¢µÄ£¬Òò´Ë°²×°JSDTÇ°Ó¦µ±ÏÈ°²×°jdk1.5+ºÍeclipse3.2+¡£
JSDTÏÂÔصØÖ·£ºhttp://code.google.com/p/jsdt/downloads/list
,ÆäÖÐjsdt-1.0.0.zipÊÇJSDTµÄ°²×°°ü£¬ÏÂÔØ°ÑÆäÖеÄÈý¸öjar°ü½âѹµ½eclipseµÄpluginsĿ¼Ï£¬ÖØÆôeclipse¼´¿É¡£
jsdt-simple.swfÊÇÒ»¶ÎʹÓÃjsdtÔÚchromeä¯ÀÀÆ÷µ÷ÊÔjavascriptµÄ¼òµ¥Àý×ӵļÏó¡£
jsdt-ext-desktop.swfÊÇÒ»¶ÎʹÓÃjsdtÔÚsafariä¯ÀÀÆ÷µ÷ÊÔjavascriptµÄ¼Ïó¡£
3.ÈçºÎʹÓÃ
1.       ÔÚeclipseÖдò¿ªµ÷ÊÔ¶Ô»°¿ò£¬ÈçÏÂͼËùʾ£º
2.       н¨Ò»¸öJavascript Debug£¬ÈçÏÂͼËùʾ
ÔÚurlÖÐÊäÈëÒªµ÷ÊÔµÄurl--±¾µØÎļþÃû»ò·þÎñÆ÷ÉϵÄÎļþÃû(Ö»Ö§³ÖhttpÀàÐ͵Äurl)¡£ÔÚbrowserÊäÈë¿òÖÐÑ¡Ôñä¯ÀÀÆ÷(ie,firefox,safari»òchromeµÈ)
µã»÷µ÷ÊÔºó»á´ò¿ªä¯ÀÀÆ÷£ ......

javascript String.replaceº¯Êý

    javascriptµÄStringÀàÄÚÖú¯Êýreplace(regexp, newString)º¯ÊýÌṩÁË×Ö·û´®Ìæ»»¹¦ÄÜ£¬´Óº¯ÊýÔ­ÐÍÉÏ¿ÉÒÔ¿´³öÖ§³Ö Regular Exp¡£´Ëº¯Êý¹¦Äܷdz£ÊµÓ㬵«Ò²Óм¸¸öµØ·½Óеã»ìÏý£¬ÏÂÃæͨ¹ýʵ¼ÊµÄÀý×ÓÀ´ËµÃ÷£º
    ±ÈÈçÎÒÃÇÏÖÔÚÒªÕë¶Ô´®
var src="<a href=&quot;http://xx.com/a/20100601/000224.htm&quot; target=&quot;_blank&quot;>xxx</a>"
ÒªÌæ»»ÆäÖеÄHTMLË«ÒýºÅµÄתÒÆ·û &quot; Ϊʵ¼ÊµÄ " , Õý³£ÎÒÃǾͻáÖ±½Óµ÷Óà src.replace(/&quot;/g, '"');À´´ïµ½Ä¿µÄ£¬µ«ÊÇjsÈÝÒ×ÈÃÈËÃÔ»óµÄÒ»µã¾ÍÊÇ£¬ÕâÑù×ö²¢Ã»ÓÐʵ¼Ê¸Ä±äsrcµÄÖµ£¬Êµ¼Ê²âÊÔ·¢ÏÖ·µ»ØÖµ²ÅÊÇÎÒÃÇÐèÒªµÄ½á¹û£¬¶øsrc±¾ÉíÈ·²»·¢Éú±ä»¯£¬ËùÒÔʵ¼ÊÖÐÐèҪͨ¹ýÈçÏÂÀ´Íê³ÉÎÒÃǵŦÄÜ£º
     src=src.replace(/&quot;/g, '"'); ......

javascript trim·½·¨

ÔÚjavascriptÖеÄstring¶ÔÏóûÓÐtrim·½·¨£¬ËùÒÔtrim¹¦ÄÜÐèÒª×Ô¼ºÊµÏÖ£º
´úÂëÈçÏ£º
Java´úÂë
﹤scriptlanguage=”javascript”﹥   
/**  
*ɾ³ý×óÓÒÁ½¶ËµÄ¿Õ¸ñ  
*/  
String.prototype.trim=function(){      
    return this.replace(/(^\s*)|(\s*$)/g, '');   
}     
/**  
*ɾ³ý×ó±ßµÄ¿Õ¸ñ  
*/  
String.prototype.ltrim=function()   
{   
  return this.replace(/(^s*)/g,'');   
}   
/**  
*ɾ³ýÓұߵĿոñ  
*/  
String.prototype.rtrim=function()   
{   
  return this.replace(/(s*$)/g,'');   
}   
﹤/script﹥  
﹤scriptlanguage=”javascript”﹥
/**
*ɾ³ý×óÓÒÁ½¶ËµÄ¿Õ¸ñ
*/
String.prototype.trim=function(){
return this.replace(/(^\s*)|(\s*$)/g, ......

JavaScript µ÷ÓÃ±íµ¥ÖØÖ÷½·¨


1 history.go(0)  
2 location.reload() £¨Ò³Ãæ½øÐÐˢУ¬µ«ÎªdisabledµÄÔªËصÄÖµ²»»á±»Çå¿Õ£©
3 location=location 
4 location.assign(location) 
5 location.replace(location) 
6 from..reset()  (Ò³Ãæ²»½øÐÐˢУ¬Ä£Äâµ¥»÷¶ÔËùµ÷ÓÃ±íµ¥ÖØÖð´Å¥µÄµ¥»÷)
......

JavaScriptÖÐconfirm,alert,promptµÄÓ÷¨

±¾ÎļòÒª½éÉÜJavaScriptÖÐconfirm,alert,promptµÄÓ÷¨,Ï£Íû´ó¼Òѧϰ¹ý³ÌÖÐÄܵõ½Ò»Ð©Æô·¢¡£
window.confirm ²ÎÊý¾ÍÖ»ÓÐÒ»¸ö¡£ÏÔʾÌáʾ¿òµÄÐÅÏ¢¡£°´È·¶¨,·µ»Øtrue£»°´È¡Ïû·µ»Øfalse¡£
< SCRIPT> var bln = window.confirm("È·¶¨Âð?"); alert(bln) < /SCRIPT> window.alert²ÎÊý£¬Ö»ÓÐÒ»¸ö£¬ÏÔʾ¾¯¸æ¿òµÄÐÅÏ¢£»ÎÞ·µ»ØÖµ¡£
< SCRIPT> window.alert("È·¶¨¡£") window.prompt²ÎÊý,ÓÐÁ½¸ö£¬µÚÒ»¸ö²ÎÊý£¬ÏÔʾÌáʾÊäÈë¿òµÄÐÅÏ¢¡£µÚ¶þ¸ö²ÎÊý,ÓÃÓÚÏÔʾÊäÈë¿òµÄĬÈÏÖµ¡£·µ»Ø£¬Óû§ÊäÈëµÄÖµ¡£
< SCRIPT> var str = window.prompt("ÇëÊäÈëÃÜÂë","password") alert(str); < /SCRIPT>
......

JavaScriptÖÐÄäÃûº¯Êý£¬º¯ÊýÖ±½ÓÁ¿ºÍ±Õ°ü(ת)

Ô­Îijö´¦: http://www.dnew.cn/post/196.htm
ÏÈ¿´ÏÂÏÂÃ漸ÖÖд·¨
1.function f(x){return x*x;};f(x);
2.(function(x){return x*x;})(x);
3.(function(x){return x*x;}(x));
µÚÒ»ÖÖÎÒÃÇÓ¦¸Ã¶¼ºÜÊìϤÁË£¬ÕâÊÇÎÒÃǾ­³£Ê¹ÓõÄд·¨¡£µÚ¶þµÚÈýÖÖ¶¼ÊÇÄäÃûº¯ÊýµÄд·¨¡£
--------------------------------------------------------------------------------
µÚ¶þÖÖ
¿ÉÒÔÕâÑùÀí½â£º
•var f=function(x) {return x*x;};f()
ÄÇÎÒÃDz»Í¨¹ýfÕâ¸ö±äÁ¿À´ÒýÓú¯Êý¾ÍÊÇ
•function(){}()
È»¶øÕâÑù¿Ï¶¨ÊÇ´íÎóµÄ¾ÍÏñ
•var f=1+2;
•f=f*0;
Óë
•var f=1+2*0;
½á¹û²»Í¬Ò»Ñù¡£
ÒªµÃµ½ÕýÈ·½á¹ûÖ»ÄÜ£º
•f=(1+2)*0;
Ò²¾ÍÊÇÒªÃ÷È·µÄ±êʶ³ö³ÌÐò¿é,¼´£º
•(function(){})()
¿ÏÄãÓÐÒÉÎÊ£ºÀ¨ºÅ“()”µ½µ×ÊDz»ÊÇÆðµ½Á˱êʶ´úÂë¿éµÄ×÷Óã¿
ÎÒÃÇ¿ÉÒÔÓÃJavaScriptµÄÄÚÖú¯Êý¼ì²âһϣ¡
¾ÙÒ»¸ö×î¼òµ¥µÄÀý×Ó£º
•alert(4)
Õâ¶Î´úÂë»áµ¯³öÌáʾÄÚÈÝÊÇ“4”
¸Ä³ÉÕâÑù
•(alert)(4)
¿ÉÒÔ¿´µ½Ö´ÐеÄЧ¹ûºÍÉÏÒ»¶Î´úÂëÒ»Ñù¡£
ÕâÖÖÐÎʽµÄº¯ÊýÖ´ÐÐÒ²±»ºÜ¶àJavaScript¿ò¼ÜËù²ÉÓá£
------------------------ ......
×ܼǼÊý:40319; ×ÜÒ³Êý:6720; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [6] [7] [8] [9] 10 [11] [12] [13] [14] [15]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ