JavaScript – Miscellaneous Validations #13

    function validateDomainName(strValue)   {       return /www.[a-z0-9_-]+.[a-z]{2, 3}/ig.test(strValue);          }   function validateDomainName(strValue)   {       return /www.[a-z0-9_-]+.[a-z]{2, 3}/ig.test(strValue);          }   //not 100% right, will fix later    function checkDateFormat()  {       var pattern = new RegExp(0|1[0-9]/[0-3][0-9]/[0-9][0-9]);       if(document.getElementById('timestampStarted').value.match(pattern))        {           var date_array = document.getElementById('timestampStarted').value.split('/');                      var month = date_array[0];          var day = date_array[1];            var year = date_array[2];           // This instruction will create a date object           source_date = new Date(year,month,day);             if(month != source_date.getMonth())         {               alert('Month is not valid!');               return false;           }               if(day != source_date.getDate())            {               alert('Day is not valid!');             return false;           }                       if(year != source_date.getYear())           {               alert('Year is not valid!');                return false;           }       }       else        {           alert('Date format is not valid!');         return false;       }           return true;    }   function validateEmail( strValue)   {       var objRegExp  = /(^[a-z]([a-z_.]*)@([a-z_.]*)([.][a-z]{3})$)|(^                [a-z]([a-z_.]*)@([a-z_.]*)(.[a-z]{3})(.[a-z]{2})*$)/i;          //check for valid email         return objRegExp.test(strValue);    }   //AJAX Example  function ajaxFunctionGeneral()  {       var page_request = false        if (window.XMLHttpRequest) // if Mozilla, IE7, Safari etc           page_request = new XMLHttpRequest()     else if (window.ActiveXObject)      { // if IE          try             {               page_request = new ActiveXObject("Msxml2.XMLHTTP")          }           catch (e)           {               try             {                   page_request = new ActiveXObject("Microsoft.XMLHTTP")               }               catch (e)               {               }           }       }       else                    return false        return page_request;    }   function reboot(deviceId)   {       var response=confirm('Are you sure to reboot');             if(!response)           exit;               page_request = ajaxFunctionGeneral();       if (!page_request) return false;                page_request.onreadystatechange=function()      {       if(page_request.readyState==4)          {               var response=page_request.responseText;             var displayArea = document.getElementById('showDiagnosticsResults');                displayArea.value = response;           }      }        page_request.open('GET', '/Inventory/Diagnostics/reboot.php?deviceId='+deviceId, true)      page_request.send(null) }

From: http://sitestree.com/?p=4779
Categories:13
Tags:
Post Data:2008-12-29 21:43:54

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>