Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. JS not working in Mozila

JS not working in Mozila

Scheduled Pinned Locked Moved ASP.NET
javascripttoolshelp
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    janani13
    wrote on last edited by
    #1

    Hi all, Im checking the password strength using JS. It works fine in IE but not in Mozila . Can any one solve my problem please. Here is the script.

    <script language="javascript" type ="text/javascript">
    function check_password_safety(pwd)
    {
    var msg = "";
    var len= pwd.length;
    var i;

                var has\_letter		= new RegExp("\[a-z\]");
                var has\_caps		= new RegExp("\[A-Z\]");
                var has\_numbers		= new RegExp("\[0-9\]");
                var has\_symbols		= new RegExp("\\\\W");
                
                
                 var pointsLetter=0;
                var pointsCaps=0;
                var pointsNumbers=0;
                var pointsSpecials=0;
                
                
                for(i=0;i<len;i++)
                {
                    var x=pwd.charAt(i);
                    if(has\_letter.test(x))
                    {
                    ++pointsLetter;
                    }
                    else if(has\_caps.test(x))
                    {
                    ++pointsCaps;
                    }
                    else if(has\_numbers.test(x))
                    {
                    ++pointsNumbers;
                    }
                    else if(has\_symbols.test(x))
                    {
                    ++pointsSpecials;
                    }
                
                }
               //  alert('Small Letters = '+pointsLetter+'\\nSmall Caps = '+pointsCaps+'\\nSmall Numbers = '+pointsNumbers+'\\nSmall Specials = '+pointsSpecials);
                 
                 
                  if(len>6)
                        {
                           // Small + Abvove 12 Char
                          if(pointsLetter>0 && pointsCaps==0 && pointsNumbers==0 && pointsSpecials==0 && len>12)
                             {   
                             password\_info.innerHTML = "Very Week";
                             password\_info.className='Style\_VeryWeek';   
                             }  
                          // Small 
                          if(pointsLetter>0 && pointsCaps==0 && pointsNumbers==0 && pointsSpecials==0 && len<12)
                             {   
                             password\_info.innerHTML = "Week";
                             password\_info.className='Style\_Week';   
                             }
    
    P P A 3 Replies Last reply
    0
    • J janani13

      Hi all, Im checking the password strength using JS. It works fine in IE but not in Mozila . Can any one solve my problem please. Here is the script.

      <script language="javascript" type ="text/javascript">
      function check_password_safety(pwd)
      {
      var msg = "";
      var len= pwd.length;
      var i;

                  var has\_letter		= new RegExp("\[a-z\]");
                  var has\_caps		= new RegExp("\[A-Z\]");
                  var has\_numbers		= new RegExp("\[0-9\]");
                  var has\_symbols		= new RegExp("\\\\W");
                  
                  
                   var pointsLetter=0;
                  var pointsCaps=0;
                  var pointsNumbers=0;
                  var pointsSpecials=0;
                  
                  
                  for(i=0;i<len;i++)
                  {
                      var x=pwd.charAt(i);
                      if(has\_letter.test(x))
                      {
                      ++pointsLetter;
                      }
                      else if(has\_caps.test(x))
                      {
                      ++pointsCaps;
                      }
                      else if(has\_numbers.test(x))
                      {
                      ++pointsNumbers;
                      }
                      else if(has\_symbols.test(x))
                      {
                      ++pointsSpecials;
                      }
                  
                  }
                 //  alert('Small Letters = '+pointsLetter+'\\nSmall Caps = '+pointsCaps+'\\nSmall Numbers = '+pointsNumbers+'\\nSmall Specials = '+pointsSpecials);
                   
                   
                    if(len>6)
                          {
                             // Small + Abvove 12 Char
                            if(pointsLetter>0 && pointsCaps==0 && pointsNumbers==0 && pointsSpecials==0 && len>12)
                               {   
                               password\_info.innerHTML = "Very Week";
                               password\_info.className='Style\_VeryWeek';   
                               }  
                            // Small 
                            if(pointsLetter>0 && pointsCaps==0 && pointsNumbers==0 && pointsSpecials==0 && len<12)
                               {   
                               password\_info.innerHTML = "Week";
                               password\_info.className='Style\_Week';   
                               }
      
      P Offline
      P Offline
      padmanabhan N
      wrote on last edited by
      #2

      if i am not wrong!!!!! some of the script will not work in Mozila..... :omg: :omg:

      Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

      1 Reply Last reply
      0
      • J janani13

        Hi all, Im checking the password strength using JS. It works fine in IE but not in Mozila . Can any one solve my problem please. Here is the script.

        <script language="javascript" type ="text/javascript">
        function check_password_safety(pwd)
        {
        var msg = "";
        var len= pwd.length;
        var i;

                    var has\_letter		= new RegExp("\[a-z\]");
                    var has\_caps		= new RegExp("\[A-Z\]");
                    var has\_numbers		= new RegExp("\[0-9\]");
                    var has\_symbols		= new RegExp("\\\\W");
                    
                    
                     var pointsLetter=0;
                    var pointsCaps=0;
                    var pointsNumbers=0;
                    var pointsSpecials=0;
                    
                    
                    for(i=0;i<len;i++)
                    {
                        var x=pwd.charAt(i);
                        if(has\_letter.test(x))
                        {
                        ++pointsLetter;
                        }
                        else if(has\_caps.test(x))
                        {
                        ++pointsCaps;
                        }
                        else if(has\_numbers.test(x))
                        {
                        ++pointsNumbers;
                        }
                        else if(has\_symbols.test(x))
                        {
                        ++pointsSpecials;
                        }
                    
                    }
                   //  alert('Small Letters = '+pointsLetter+'\\nSmall Caps = '+pointsCaps+'\\nSmall Numbers = '+pointsNumbers+'\\nSmall Specials = '+pointsSpecials);
                     
                     
                      if(len>6)
                            {
                               // Small + Abvove 12 Char
                              if(pointsLetter>0 && pointsCaps==0 && pointsNumbers==0 && pointsSpecials==0 && len>12)
                                 {   
                                 password\_info.innerHTML = "Very Week";
                                 password\_info.className='Style\_VeryWeek';   
                                 }  
                              // Small 
                              if(pointsLetter>0 && pointsCaps==0 && pointsNumbers==0 && pointsSpecials==0 && len<12)
                                 {   
                                 password\_info.innerHTML = "Week";
                                 password\_info.className='Style\_Week';   
                                 }
        
        P Offline
        P Offline
        Parwej Ahamad
        wrote on last edited by
        #3

        First try to find out with the help of Alert() that which line of code is not working so can easily help you.

        Parwej Ahamad http://parwej.wordpress.com/

        1 Reply Last reply
        0
        • J janani13

          Hi all, Im checking the password strength using JS. It works fine in IE but not in Mozila . Can any one solve my problem please. Here is the script.

          <script language="javascript" type ="text/javascript">
          function check_password_safety(pwd)
          {
          var msg = "";
          var len= pwd.length;
          var i;

                      var has\_letter		= new RegExp("\[a-z\]");
                      var has\_caps		= new RegExp("\[A-Z\]");
                      var has\_numbers		= new RegExp("\[0-9\]");
                      var has\_symbols		= new RegExp("\\\\W");
                      
                      
                       var pointsLetter=0;
                      var pointsCaps=0;
                      var pointsNumbers=0;
                      var pointsSpecials=0;
                      
                      
                      for(i=0;i<len;i++)
                      {
                          var x=pwd.charAt(i);
                          if(has\_letter.test(x))
                          {
                          ++pointsLetter;
                          }
                          else if(has\_caps.test(x))
                          {
                          ++pointsCaps;
                          }
                          else if(has\_numbers.test(x))
                          {
                          ++pointsNumbers;
                          }
                          else if(has\_symbols.test(x))
                          {
                          ++pointsSpecials;
                          }
                      
                      }
                     //  alert('Small Letters = '+pointsLetter+'\\nSmall Caps = '+pointsCaps+'\\nSmall Numbers = '+pointsNumbers+'\\nSmall Specials = '+pointsSpecials);
                       
                       
                        if(len>6)
                              {
                                 // Small + Abvove 12 Char
                                if(pointsLetter>0 && pointsCaps==0 && pointsNumbers==0 && pointsSpecials==0 && len>12)
                                   {   
                                   password\_info.innerHTML = "Very Week";
                                   password\_info.className='Style\_VeryWeek';   
                                   }  
                                // Small 
                                if(pointsLetter>0 && pointsCaps==0 && pointsNumbers==0 && pointsSpecials==0 && len<12)
                                   {   
                                   password\_info.innerHTML = "Week";
                                   password\_info.className='Style\_Week';   
                                   }
          
          A Offline
          A Offline
          Abhishek Sur
          wrote on last edited by
          #4

          there is nothing written wrong in the code. The only thing that comes into my notice is

          password_info.innerHTML

          Always remove the existing childelements before you set the innerHTML, so that if there is any child elements present, IE will throw an error. Use like this :

          function setContent(container, content) {
          if (!!container) {
          while (container.firstChild)
          container.removeChild(container.firstChild);

                  var dummyDiv = document.createElement('div');
                  dummyDiv.innerHTML = content;
          
                  container.appendChild(dummyDiv);
              }
          }
          

          Now call setContent(password_info,"yourhtml") On your problem, I think there must be problem somewhere else. Check Mozilla Error Console for that entry. :thumbsup:

          Abhishek Sur


          My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

          **Don't forget to click "Good Answer" if you like to.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups