Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9054335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:39:51+00:00 2026-06-16T13:39:51+00:00

The following code works well in IE but not in Chrome or Firefox. If

  • 0

The following code works well in IE but not in Chrome or Firefox.

If someone could suggest the changes, it would be much appreciated.

The code is in the following link

http://www.4shared.com/office/HJNhTiwB/123.html

<html xmlns="http://www.w3.org/1999/xhtml&quot;&gt; 
<head runat="server"> 
<title>MRBN Textbox Sample</title> 
<style type="text/css"> 
.MRBN 
{ 
    width:145px; 
    font-family:Verdana; 
    font-size:12pt; 
    font-weight:bold; 
    text-transform: uppercase;
    color: #EDEBEC; 
} 
</style> 
</head> 
    <script type="text/javascript"> 
        function ValidateText(evnt) { 
            TxtLen = document.getElementById("TxtMRBN").value.length; 
            document.getElementById("TxtMRBN").style.color = "#33CC33"; 
            if (TxtLen < 5) { 
                if ((((evnt.keyCode > 64) && (evnt.keyCode < 91)) || ((evnt.keyCode > 96) && (evnt.keyCode < 123))) != true) { 
                    alert("1st letter/1st name +1st 4/last name..."); 
                    return false; 
                } 
            } 
            else if (TxtLen == 5) { 
                if (evnt.keyCode != 45) { 
                    alert("This needs dash or hyphen here..."); 
                    return false; 
                } 
            } 
            else if ((TxtLen > 5) && (TxtLen < 11)) { 
                    if (((evnt.keyCode > 47) && (evnt.keyCode < 58)) != true) { 
                        alert("Put last 5 of your phone number..."); 
                        return false; 
                    } 
            } 
            else { 
                alert("5-5. Now give it to Riders & WIN...!"); 
                return false; 
            } 
        }

    function ClearText() { 
        if (document.getElementById("TxtMRBN").value == "ALPHA-NUMBR") { 
            document.getElementById("TxtMRBN").value = ""; 
        } 
        return false; 
    } 
</script> 
<body> 
    <form id="form1" runat="server"> 
        <div> 
            <input type="text" id="TxtMRBN" class="MRBN" value="ALPHA-NUMBR" onkeypress="return ValidateText(event);" onmousedown="return ClearText();" /> 
        </div> 
    </form> 
</body> 
</html>

Regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:39:52+00:00Added an answer on June 16, 2026 at 1:39 pm

    use this code its working in IE,mozilla,chrome

        <html>
        <head> 
        <title>MRBN Textbox Sample</title> 
        <style type="text/css"> 
        .MRBN 
        { 
            width:145px; 
            font-family:Verdana; 
            font-size:12pt; 
            font-weight:bold; 
            text-transform: uppercase;
            color: #EDEBEC; 
        } 
        </style> 
        </head> 
            <script type="text/javascript"> 
    
                function ValidateText(evnt) { 
             var browserName=navigator.appName; 
    
           if (browserName=="Microsoft Internet Explorer")
           {
                    TxtLen = document.getElementById("TxtMRBN").value.length; 
                    document.getElementById("TxtMRBN").style.color = "#33CC33"; 
                    if (TxtLen < 5) { 
                        if ((((evnt.keyCode > 64) && (evnt.keyCode < 91)) || ((evnt.keyCode > 96) && (evnt.keyCode < 123))) != true) { 
                            alert("1st letter/1st name +1st 4/last name..."); 
                            return false; 
                        } 
                    } 
                    else if (TxtLen == 5) { 
                        if (evnt.keyCode != 45) { 
                            alert("This needs dash or hyphen here..."); 
                            return false; 
                        } 
                    } 
                    else if ((TxtLen > 5) && (TxtLen < 11)) { 
                            if (((evnt.keyCode > 47) && (evnt.keyCode < 58)) != true) { 
                                alert("Put last 5 of your phone number..."); 
                                return false; 
                            } 
                    } 
                    else { 
                        alert("5-5. Now give it to Riders & WIN...!"); 
                        return false; 
                    } 
               }
               else  //for firefox and chrome
               {
                     TxtLen = document.getElementById("TxtMRBN").value.length; 
                    document.getElementById("TxtMRBN").style.color = "#33CC33"; 
                    if (TxtLen < 5) { 
                        if ((((evnt.which > 64) && (evnt.which < 91)) || ((evnt.which > 96) && (evnt.which < 123))) != true) { 
                            alert("1st letter/1st name +1st 4/last name..."); 
                            return false; 
                        } 
                    } 
                    else if (TxtLen == 5) { 
                        if (evnt.which != 45) { 
                            alert("This needs dash or hyphen here..."); 
                            return false; 
                        } 
                    } 
                    else if ((TxtLen > 5) && (TxtLen < 11)) { 
                            if (((evnt.which > 47) && (evnt.which < 58)) != true) { 
                                alert("Put last 5 of your phone number..."); 
                                return false; 
                            } 
                    } 
                    else { 
                        alert("5-5. Now give it to Riders & WIN...!"); 
                        return false; 
                    } 
               }
             }
    
            function ClearText() { 
                if (document.getElementById("TxtMRBN").value == "ALPHA-NUMBR") { 
                    document.getElementById("TxtMRBN").value = ""; 
                } 
    
            } 
        </script> 
        <body> 
    
        <form id="form1" > 
                <div> 
                    <input type="text" id="TxtMRBN" class="MRBN" value="ALPHA-NUMBR" onkeypress="return ValidateText(event);" onmousedown="ClearText();" /> 
                </div> 
          </form>
        </body> 
        </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the following code works well in Chrome/FireFox, but error in IE. The error shows
The following code works fine in firefox but as with many other things, I
The following code works as expected on CentOS and Ubuntu O/s but not on
my javascript Application works on firefox and chrome very well. But it seams to
The following code works in Google Chrome beta as well as IE 7. However,
I have the following code that compiles and works well: template<typename T> T GetGlobal(const
I'm trying the following code http://code.google.com/apis/ajax/playground/#change_the_playing_video It works well when runned from the playground
The following code works fine on Linux but throws an exception on OS X
The following code works in all browser but IE8 and below. // Create Paragraph
The following code works, but I can't figure out what's going on memory-wise. Where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.