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">
<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
use this code its working in IE,mozilla,chrome