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

ÀûÓÃjavascriptÑéÖ¤ÊäÈë¿òÖеÄÖµÊÇ·ñΪÈÕÆÚ¸ñʽ

1¡¢ÅжÏÊÇ·ñΪÄêÔÂÈÕʱ¼ä¸ñʽ
<script>
//È¥³ý×Ö·û´®Ê×β¿Õ¸ñ
String.prototype.trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
//ÑéÖ¤ÊÇ·ñΪÈÕÆÚ
function validator(){ 
    if(isDate(document.all.demo1.value.trim())==false){
     document.all.demo1.select();
     return false;
    }
   
}
/**  
    ÅжÏÊäÈë¿òÖÐÊäÈëµÄÈÕÆÚ¸ñʽÊÇ·ñΪ yyyy-mm-dd   »òyyyy-m-d
  */  
function isDate(dateString){
  if(dateString.trim()=="")return true;
  //ÄêÔÂÈÕÕýÔò±í´ïʽ
  var r=dateString.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
        if(r==null){
   alert("ÇëÊäÈë¸ñʽÕýÈ·µÄÈÕÆÚ\n\rÈÕÆÚ¸ñʽ£ºyyyy-mm-dd\n\rÀý    È磺2008-08-08\n\r");
   return false;
  }
        var d=new Date(r[1],r[3]-1,r[4]);   
  var num = (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]);
  if(num==0){
   alert("ÇëÊäÈë¸ñʽÕýÈ·µÄÈÕÆÚ\n\rÈÕÆÚ¸ñʽ£ºyyyy-mm-dd\n\rÀý    È磺2008-08-08\n\r");
  }
  return (num!=0);
  

</script>
²âÊÔÊÇ·ñΪÄêÔÂÈÕʱ¼ä¸ñʽ
 <input type='text' name='demo1'  >
 <br>
 <input type='button' name='demo2' value="È·¶¨" onclick="validator()" >
ÒÔÉÏ´úÂëʵÏÖÁËÑéÖ¤ÄêÔÂÈÕ
2¡¢ÅжÏÊÇ·ñΪÄêÔÂÈÕʱ·ÖÃëʱ¼ä¸ñʽ
<script>
//È¥³ý×Ö·û´®Ê×β¿Õ¸ñ
String.prototype.trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
//ÑéÖ¤ÊÇ·ñΪÈÕÆÚ
function validator(){ 
    if(isDate(document.all.demo1.value.trim())==false){
     document.all.demo1.select();
     return fals


Ïà¹ØÎĵµ£º

JavascriptÎļþ¼°Îļþ¼Ð²Ù×÷

JavascriptÎļþ¼°Îļþ¼Ð²Ù×÷
 
Ò»¡¢¹¦ÄÜʵÏÖºËÐÄ£ºFileSystemObject ¶ÔÏó
    ÒªÔÚjavascriptÖÐʵÏÖÎļþ²Ù×÷¹¦ÄÜ£¬Ö÷Òª¾ÍÊÇÒÀ¿¿FileSystemobject¶ÔÏó¡£
¶þ¡¢FileSystemObject±à³Ì
ʹÓÃFileSystemObject ¶ÔÏó½øÐбà³ÌºÜ¼òµ¥£¬Ò»°ãÒª¾­¹ýÈçϵIJ½Ö裺 ´´½¨FileSystemObject¶ÔÏó¡¢Ó¦ÓÃÏà¹Ø·½·¨¡¢· ......

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+ ......

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

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

JavaScript¾­µäÓï¾ä¼°Æä»ù±¾Ó¦ÓÃ

¡ö´ò¿ª¡ö
<input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=´ò¿ª>
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
¡öÁí´æΪ¡ö
<input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) typ ......

javascriptдÔÚº¯ÊýÀïÃæ

javascriptдÔÚº¯ÊýÀïÃæ
function loadscript(url) {
document.write('<scr' + 'ipt  type="text/javascript" src"' + url + '"><\/scr' + 'ipt>'>)
}
Ôڳɹ¦µÄÕýÔò±í´ïʽ²éÕÒÍê³É֮ǰ£¬ÆäÊôÐÔֵΪ undefined¡£
²»Òª½«È«¾Ö RegExp ¶ÔÏóÓë ÕýÔò±í´ïʽ
¶ÔÏó»ìÏý¡£¾¡¹ÜÌýÆðÀ´Ï ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ