Link to home
Start Free TrialLog in
Avatar of jknj72
jknj72

asked on

Trying to use Enter key to run button code

I put a panel around 2 fieldsets and if the wrong number of chars or a wrong date is entered it will cause a ValidationSummary to put up error messages. In works in IE but not Firefox? Does anyone know what I can do to try and figure this out. It should only fire when the txtName or txtDate in the first field set and the txtFileNumber in the second fieldset. Those are the mandatory fields

I have this in the markup
    <script type="text/javascript" language="javascript">function sf() {  document.forms.Form1.txtName.focus();  }

        function showkey() {
            if (event.keyCode == 13) {
                switch (document.activeElement.id) {
                    // txtname
                    case 'txtName': document.forms.Form1.btnBeginSearch.focus(); break;
                        // txtDate
                    case 'txtDate': document.forms.Form1.btnBeginSearch.focus(); break;
                        // txtCity
                    case 'txtCity': document.forms.Form1.btnBeginSearch.focus(); break;
                        // txtState
                    case 'txtState': document.forms.Form1.btnBeginSearch.focus(); break;
                        // txtState
                    case 'txtFileNumber': document.forms.Form1.btnBeginSearch.focus(); break;
                        // txtState
                    case 'txtFAccidentDate': document.forms.Form1.btnBeginSearch.focus(); break;
                        // btnBeginSearch
                    case 'btnBeginSearch': document.forms.Form1.btnBeginSearch.focus(); break;
                }
            }
        }
        document.onkeydown = showkey;

    </script>

Open in new window



and this is the View Source from Firefox

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head id="HEAD1"><title>
	Proof Of Coverage
</title><link href="MainCss.css" type="text/css" rel="stylesheet" />
    <!--<meta content="False" name="vs_showGrid" /><meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR" /><meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE" /><meta content="JavaScript" name="vs_defaultClientScript" /><meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema" />-->

    <script type="text/javascript" language="javascript">function sf() {  document.forms.Form1.txtName.focus();  }

        function showkey() {
            if (event.keyCode == 13) {
                switch (document.activeElement.id) {
                    // txtname
                    case 'txtName': document.forms.Form1.btnBeginSearch.focus(); break;
                        // txtDate
                    case 'txtDate': document.forms.Form1.btnBeginSearch.focus(); break;
                        // txtCity
                    case 'txtCity': document.forms.Form1.btnBeginSearch.focus(); break;
                        // txtState
                    case 'txtState': document.forms.Form1.btnBeginSearch.focus(); break;
                        // txtState
                    case 'txtFileNumber': document.forms.Form1.btnBeginSearch.focus(); break;
                        // txtState
                    case 'txtFAccidentDate': document.forms.Form1.btnBeginSearch.focus(); break;
                        // btnBeginSearch
                    case 'btnBeginSearch': document.forms.Form1.btnBeginSearch.focus(); break;
                }
            }
        }
        document.onkeydown = showkey;

    </script>

    <link id="Link1" rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <!--NAME="Link1">-->
    <link id="Link2" rel="icon" href="favicon.ico" type="image/ico" />
    <!--NAME="Link2">-->

    <script type="text/javascript" language="javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-9077260-5']);
        _gaq.push(['_trackPageview']);

        (function () {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();

    </script>

<link href="/WebResource.axd?d=Cg7vFR8z7AOpJNkNzNQRWEAjIC7FIJOFjU45b_8gGQOXHadQSSN-1_BSaMDhFramCE1EGO16myg358xiThwVjcWyP4LqWldBR-R6uI6-yNu0xppcqnUMibNzKaryX4iNIGiY9DT403YZR0kZ5zaPXtKNid14V61Ah3XtMy00dzU1&amp;t=635730008181229390" type="text/css" rel="stylesheet" /><link href="/WebResource.axd?d=U-IiEkmYbAILvUzKwIUw3yxH2ecqqWDYuej3O0CiWvnfgdtHUD9qxM3GN4XgacaUfc92tnKyVUtAHPid9zWglvdnvHWFx_aGDcjecPCMIOQVQzR6R6VE_SYx0uLdfGUVVJshTBr9i15Zj3DPGFUvlERMr_Z2PRdZc067a5Tsmg81&amp;t=635730008181229390" type="text/css" rel="stylesheet" /></head>
	<body bgColor="#ffffff" background="./images/testbg.gif" style="margin-top:0" onload="sf()">
        <form method="post" action="PcovA.aspx" onsubmit="javascript:return WebForm_OnSubmit();" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'btnBeginSearch')" id="Form1">
<div class="aspNetHidden">
<input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTY0OTQ5MTY0MA8WAh4JU2NyZWVuUmVzBQkxOTIweDEwODAWAgIDD2QWDAILD2QWAgIBDw8WAh4EVGV4dAUXOC8xMy8yMDE1IGF0IDQ6MTM6MjIgUE1kZAIPDw8WAh8BBasBWW91IG1heSBlbnRlciBhbnkgd29yZChzKSBvciBwYXJ0IG9mIGEgd29yZCB0aGF0IGFwcGVhciBpbiB0aGUgY29tbWVyY2lhbCBuYW1lIG9yIGluZGl2aWR1YWwgbmFtZSBvZiB0aGUgZW1wbG95ZXIgZm9yIHdoaWNoIHlvdSBhcmUgcmVxdWVzdGluZyBwb2xpY3kgY292ZXJhZ2UgaW5mb3JtYXRpb24uZGQCEQ8QDxYCHgdDaGVja2VkZ2RkZGQCFQ8QDxYCHwJoZGRkZAIXD2QWDAIDDw8WAh4HRW5hYmxlZGdkZAIHDw8WAh8DZ2RkAgkPDxYCHwNnZGQCCw8WAh8DZ2QCDw8PFgIfA2dkZAITDw8WAh8DZ2RkAhsPZBYIAgMPDxYEHwNoHwFlZGQCCg8PFgQfA2gfAWVkZAIMDw8WAh8DaGRkAg4PFgIfA2hkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYFBQ5yYnRuTmFtZVNlYXJjaAUOcmJ0bkZpbGVTZWFyY2gFDnJidG5GaWxlU2VhcmNoBQtpbWdDYWxlbmRhcgUMaW1nQ2FsZW5kYXIxAp6qGy56pnfGa7JSZKBVa0VvBL3ofJ7nNWuJ81wLI1g=" />
</div>

<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['Form1'];
if (!theForm) {
    theForm = document.Form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>


<script src="/WebResource.axd?d=h4C5n5BNQFEtu4daHknxXXUE1CR_fEYR87hc5O5QExHTpWEtA_5FltHjrBCxbPg2mJ1PSrJ1wmxjoT1PSudzZGlBiI4OLK9tzu_0_LHTgQk1&amp;t=635586505120000000" type="text/javascript"></script>


<script src="/ScriptResource.axd?d=EimagEJIctPnWlnLDUz2lPybSHNJMhKcUELnI59o37w8oj0etctGnNqv6Gbb8p5SAYTJGpGAVCMeXPaCIqkg_pabo1dyFf_ag4w9R4Zv0zi7j-bFJvs6ooanZrHmAxEo57EVEk5TLmZqj_L_z7vYycl06lUFDN55D7BBGy4R1FE1&amp;t=5303ace5" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=Q3c8cEBM3CYbZ4lwdGiF0LbsHauMV5QwPgcV8HoxIXcIZlPXSVOpGXAZY2X1aEJAKLwpyelP5qIyjz8C3N7r37G2Mp_a--lV_dFJrqZacaXXp4kYfKy5QKYjvW2Mqh0GWRtANI57yj-LHR5GcOu15-zmuvlS65gliLjimpPI-sIApiJYhMedv5Zzq98htess0&amp;t=7b689585" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax client-side framework failed to load.');
//]]>
</script>

<script src="/ScriptResource.axd?d=pTBTgtO9C3i3nR4mrCnZwwzgugFv6YuY30W3Za9s73WgPBSU3fTI_6ti3GSDFNt2pSDsHpk-nXzMaSWc1IUMZnKPcUwruCC_T00gPf5knFKuBzgm8vJk_JjCApttPSxjDGBAZanTrefCcMAmZF60vP3Vsz5eJnv9aG6aShzaf-nyYPmu6uf-UE98q0SKC27_0&amp;t=7b689585" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=tcgSOhTTLZNMQDGp_jY1Cl0cf84z2VWAjeOimtfpI3Pin-YydIVDYCGFkpG02bXS5b2W9lmuZhoNDRq0GiIvgY-Q2de4yD82uUY6Vuo8ZvpLCPwDj-8fKc8cj_Cp0jHn514JM4V0auVPxzUU3b795Q2&amp;t=5d547c40" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=3ZW7I0kzAXLK10hQiqhS6z_oHYqzeQm5UA0gbMvkAp0jix-ZilIk94CatOjPbvXjFUDYJ_egGeVzoaxdM6zkQLWXL94SOQH6eOSH1DwDdrdIMY15IDF_3Xr8pVI3NJHC8xkpyxJhAKGxRmNW3eyxtQ2&amp;t=5d547c40" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=fbnaGEbRqq50nh19eF9aJYsxID_AZQdKNXXmeTNyBzwJh74GIZLUPnEBBwchOscIii9An-h8iY13-hyXrB-cMuR1eMHu9TwcoePA2IpWLErdqKHQ1GvtW-4d6JnAPw7S0&amp;t=5d547c40" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=nQUO1w-xNJ2BfFLusSXeexitB7ldO4j2q4IOJwVj001r_VZiGZ_uBeWx9-UI0fr7wh18FI6MOXTk_39n7E7wPs5hrQUVDCuygf97gRXQ5raoOfePS-tm5yeX-ZQ2d5H1BFx2ax36ZS3kPIv5OOxW0g2&amp;t=5d547c40" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=kARMw5iLLStRj0GQo7LCtW95RIfNbSGGPYjCE77y6xgVTC5aRWvAf6YnXJ3DWxLP6aCfhCuyGjg5Ah5Srw-JLhzT_Gft6NPAFLU-KECQEZ5xCqb5xUwbtbs3LapBMlcFoVcCkrIxi1ffrpYJUVeFbg2&amp;t=5d547c40" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=D_SFuBGnhWl1FSGO7uAT9tLpO-VweG63l9fyQiuGWQgkM3yS3u_Bvr7vWRoaRtgb7AIJ88Pb_ZuFDaHlPKEv42S5BN1N5zPVycrw08i5a-mM-ckfA5AnP42rmVEJzMv9gLMmVCSGvgD77eKGBWkjFA2&amp;t=5d547c40" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=w4Mm3uHduQ2JCeXxgHbZFbqUHqRMV0jyP5mvSr-5PfW9JyUORdd75N9_MYGMNQKeEWUN-GJasjTniceGfMqWKiq9-mw40MHLlMnuLY68E39MtL-ONOv0m42evFaDNkDaYTM-Md7vn9Omg9Uc-x2udw2&amp;t=5d547c40" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=kmv5ib9Z8fHGo4Mf_rYvRspuD8LW0LnG9VBQoiBTfWNouJhfhS6vKUplPIAo_6WZV3J0BhqI-g2ttAw32bIpm9JZRJY4iurgpXE2v_pnSg2Qp5wDOxmGaoEFe964c7Ji0&amp;t=5d547c40" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=JCOP5nX55lBe4MSYeVY9CBcHCDMWIaqb15fHQSYFiKS2HdYR3YaOf5IE0NQUgngz6cSU2s9uI_0kL8mUEwPYnVQbNkRZhm8h6iasvKe6JoeikNuzMDkpDUevHXzw9eN-0&amp;t=5d547c40" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=4Q5c4XIBqx6gvkseHl0zKAUDYoWcszZdRIporROAvvCgiJ5_TBYl5WQxdg9yuYIT0zA5hLCkjeLOw5510MwjAadqxDBiMgIWl7uZRq7uekDYB3DW5vcS0Wyfm8S_C82KmOoXwnJT809ln_4gwVpnmw2&amp;t=5d547c40" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=tdjW2r5lYgCMUb2DlkyeGMvY-FmvyZqmGtx9v6jqMfPY5-fxP98H5PhtUmcn7o7gHVW3dntU-qHxHkylCZ0YH9va0pWMpHq2-K6mcOIOg-u3DGcFuyuw_4sE7FdQZmN00&amp;t=5d547c40" type="text/javascript"></script>
<script src="/WebResource.axd?d=Tre_MeIKqnXkRhp9-JMPzKuhS0-8o0CHVuTd64iy3i9iBhNfrSMWpps_Au3A12G8JW-vcGNW1HJlHcxh4HrbFzIQOMmfYGFTFGjxoOTeb481&amp;t=635586505120000000" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
//]]>
</script>
 
           <script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('ScriptManager1', 'Form1', [], [], [], 90, '');
//]]>
</script>
   

            <table id="Table2" align="left" style="height: 500px; vertical-align: top; text-align:left" 
                cellspacing="0" cellpadding="0" width="900px" border="0" >
				<tr>
					<td width="3%" height="1"></td>
					<td width="8%" height="1"></td>
					<td width="86%" height="1"></td>
					<td width="3%" height="1" ></td>
				</tr>
				<tr>
					<td width="3%">&nbsp;</td>
					<td vAlign="middle" align="left" width="8%" height="73" rowSpan="3">
						<!--***************************************Test Image*********************************-->
                        <a style="BORDER-BOTTOM-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none"
							href="http://www.njcrib.com"> 
							<!--<IMG height="113" src="nj3.gif" width="65" border="0">-->
                            <!--<IMG height="113" src="./images/nj3.gif" width="65" border="0">-->
                            <img id="Image1" src="images/nj3.gif" style="border-style:None;height:113px;width:65px;" />
                        </a>

					</td>
                    
					<td vAlign="middle" align="left" colSpan="2" height="73">
						<!--***************************************Test Image*********************************-->
                        <a style="BORDER-BOTTOM-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none"
							href="http://www.njcrib.com"> 
							<!--<IMG height="50" src="logo.gif" width="180" border="0">-->
                            <!--<IMG height="50" src="./images/logo.gif" width="180" border="0">-->
                            <img id="Image2" src="images/logo.gif" style="height:50px;width:180px;border:0" />             					
                        </a>

					</td>
                           
				</tr>
				<tr>
					<td width="100%" colSpan="4" height="10"></td>
				</tr>
				<tr>
					<td width="100%" colSpan="4" height="10"></td>
				</tr>
				<tr>
					<td colspan="4">
						<table width="100%" border="0" cellspacing="0" cellpadding="0" ID="Table3">
							<tr align="left">
								<td width="1%">
                                    <img id="Image4" src="images/testl.gif" />
								</td>
								<td width="5%" bgcolor="#ffffff"></td>
								<td width="88%" bgColor="#ffffff">&nbsp;</td>
								<td width="5%" bgcolor="#ffffff"></td>
								<td align="right" width="1%">
                                    <img id="Image3" src="images/testr.gif" />
                                </td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td vAlign="top" align="center" colSpan="4">
						<table id="Table5" cellSpacing="0" cellPadding="0" width="100%" align="center" bgColor="#ffffff"
							border="0" style="vertical-align:top">  
							<tr vAlign="top">
								<td width="3%">&nbsp;</td>
								<td align="center" width="94%" colspan="2">
                                    <span class="Where">
										<P>
                                            <br>											
											POLICY COVERAGE SEARCH
                                            <br>
										</P>
                                        <hr width="90%" noshade="noshade" size="3" />
									</span>
									<table id="divTable" width="100%" border="0">
										<tr>
											<td width="10%">&nbsp;</td>
											<td width="80%" align="center">
                                                 

<table id="Table1" style="width: 400px; height: 34px" cellspacing="1" cellpadding="1"
    width="400" border="0">
    <tr>
        <td class="DateAsOf" align="center">Data Current as of:&nbsp;&nbsp;
            <span id="FileUploadDate1_lblDateAsOf" style="display:inline-block;font-weight:bold;width:150px;">8/13/2015 at 4:13:22 PM</span>
            <br />
            <!--<span><font style="color:Red" ><b>**The Search Data is Currently Under Development and will be Released Soon.** </b></font></span>		-->

        </td>
    </tr>
</table>

											</td>
											<td width="10%">&nbsp;</td>
										</tr>
										<tr>
											<td width="10%">&nbsp;</td>
											<td width="80%">
                                                <div align="center"><br>
													<span id="lbldescript1" class="Pcov1TopLabel">NOTE: Policy coverage information reflects only policies with effective dates within the last 72 months.</span>
													<HR style="width: 98.53%; height: 4px" width="98.53%" noShade="noshade" size="3">
												</div>
											</td>
											<td width="10%">&nbsp;</td>
										</tr>
										<tr>
											<td width="10%">&nbsp;</td>
											<td width="80%">
                                                <div align="center">
                                                    <span id="lblDescript3" class="Pcov1LabelInfo">You may enter any word(s) or part of a word that appear in the commercial name or individual name of the employer for which you are requesting policy coverage information.</span>
											    </div>
											</td>
											<td width="10%">&nbsp;</td>
										</tr>
									</table>
								</td>
								<td width="3%">&nbsp;</td>
							</tr>
							<tr>
								<td width="3%">&nbsp;</td>
								<td align="center" width="94%"></td>
								<td width="3%">&nbsp;</td>
							</tr>
                            
							<tr>
                                
								<td width="3%">&nbsp;</td>
								<td vAlign="top" align="center" width="94%" colSpan="2">

								<table style="WIDTH: 966px; HEIGHT: 241px">
                                    
									<tr>

                                        <td width="33%" align="center" style="HEIGHT: 23px;">
                                            <span class="Pcov1Labels" style="Z-INDEX: 97; TOP: 0px;"><input id="rbtnNameSearch" type="radio" name="WhichSearch" value="rbtnNameSearch" checked="checked" tabindex="1" /><label for="rbtnNameSearch">Name Search</label></span>
                                        </td>
                                        <td width="33%" align="center">
                                            <span id="lblSeparator" class="Pcov1LabelInfo" style="Z-INDEX: 98; left:355px;">OR</span>
                                        </td>
                                        <td width="33%" align="center" >
                                            <span class="Pcov1Labels" style="Z-INDEX: 99; TOP: 0px;"><input id="rbtnFileSearch" type="radio" name="WhichSearch" value="rbtnFileSearch" onclick="javascript:setTimeout(&#39;__doPostBack(\&#39;rbtnFileSearch\&#39;,\&#39;\&#39;)&#39;, 0)" tabindex="2" /><label for="rbtnFileSearch">Coverage ID Search</label></span>
                                        </td>

                                    </tr>
                                       
									<tr>										
                                        
										<td>
                                            <div id="pnlSearch" onkeypress="javascript:return WebForm_FireDefaultButton(event, &#39;btnBeginSearch&#39;)">
	
                                            <fieldset style="POSITION: relative; WIDTH: 421px; HEIGHT: 192px; text-align: right">

                                                <p>
                                                    <span id="lblEmployerName" class="Pcov1Labels" style="display:inline-block;height:24px;width:108px;Z-INDEX: 101; POSITION: absolute; TOP: 16px;
                                                        left: 2px; text-align: left">Employer Name</span>

                                                </p>
                                                <p>
                                                
                                                    <input name="txtName" type="text" maxlength="60" id="txtName" tabindex="3" style="Z-INDEX: 113; POSITION: absolute; TOP: 16px; LEFT: 125px;width: 245px;" />
                                                    <span id="lblDateOfAccident" class="Pcov1Labels" style="Z-INDEX: 107; POSITION: absolute; TOP: 56px;LEFT: 2px; text-align: left">Date of Accident</span>

                                                    <input name="txtDate" type="text" maxlength="10" id="txtDate" tabindex="5" style="Z-INDEX: 106; POSITION: absolute; TOP: 56px; LEFT: 125px;width: 103px; height: 22px;" />

                                                    <input type="image" name="imgCalendar" id="imgCalendar" tabindex="5" src="Images/Calendar.png" align="top" style="width:25px;z-index: 107; left: 230px; POSITION: absolute; TOP: 56px; height: 26px;" />

                                                    

                                                    <span id="lblCity" class="Pcov1Labels" style="display:inline-block;width:104px;Z-INDEX: 105; POSITION: absolute; TOP: 96px; LEFT: 2px;
                                                        text-align: left">City (Optional)</span>
                                                    <input name="txtCity" type="text" maxlength="20" id="txtCity" tabindex="6" style="Z-INDEX: 108; POSITION: absolute; TOP: 96px; LEFT: 125px; text-align: left;
                                                        width: 215px;" />

                                                    <span id="lblState" class="Pcov1Labels" style="display:inline-block;width:107px;Z-INDEX: 103; POSITION: absolute; TOP: 136px; LEFT: 2px;
                                                        text-align: left">State (Optional)</span>
                                                    <input name="txtState" type="text" maxlength="2" id="txtState" tabindex="7" style="width:48px;Z-INDEX: 104; POSITION: absolute; TOP: 136px; LEFT: 125px" />
                                                
                                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                </p>
                                                <p>
                                                    <span id="rqdName" style="display:none;">*</span>
                                                </p>
                                                <p>
                                                    <span id="rqdDate" style="display:none;">*</span>
                                                    <span id="rglrEffDate" style="display:none;">*</span>
                                                </p>
                                                <p>
                                                    <span id="rglrDate" style="display:none;">*</span>
                                                </p>
                                                <p>
                                                    <span id="rglrCity" style="display:none;">*</span>
                                                    <span id="rglrState" style="display:none;">*</span>
                                                </p>

                                            </fieldset>                                            
                                            
</div>
										</td>
                                          
										<td>
                                            <input type="submit" name="btnBeginSearch" value="Begin Search" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;btnBeginSearch&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="btnBeginSearch" tabindex="11" style="background-color:LightSteelBlue;height:26px;width:90px;" />

										</td>
                                                                        
										<td>
                                            <div id="pnlSearch1" onkeypress="javascript:return WebForm_FireDefaultButton(event, &#39;btnBeginSearch&#39;)">
	
											<fieldset style="POSITION: relative; WIDTH: 428px; HEIGHT: 192px;text-align:left">
											
											<P><br>	
                                            
                                                <span id="lblFileNumber" class="Pcov1Labels" style="display:inline-block;height:8px;Z-INDEX: 112; POSITION: relative; TOP: 0px; LEFT: 80px">Coverage ID</span>
                                                <input name="txtFileNumber" type="text" maxlength="7" id="txtFileNumber" disabled="disabled" tabindex="8" class="aspNetDisabled" style="Z-INDEX: 113; POSITION: relative; TOP: 0px; LEFT: 98px" />
                                                
                                            
                                                
                                                <P>
											
												<span id="lblFileAccidentDate" class="Pcov1Labels" style="Z-INDEX: 114; POSITION: relative; TOP: 0px; LEFT: 0px">Date of Accident(Optional)</span>
                                                        
                                                <input name="txtFAccidentDate" type="text" maxlength="10" id="txtFAccidentDate" disabled="disabled" tabindex="9" class="aspNetDisabled Pcov1Labels" style="width:103px;Z-INDEX: 115; POSITION: relative; TOP: 0px; LEFT: 5px; height: 22px;" />
                                                        
                                                    <input type="image" name="imgCalendar1" id="imgCalendar1" disabled="disabled" tabindex="10" class="aspNetDisabled" src="Images/Calendar.png" align="top" style="width:25px;left:4px; POSITION: relative; TOP: 0px; height: 26px;" />        

                                                
                                            <P><br>        

                                                
                                                

											</P>
			                                </fieldset>
                                            
</div>
										</td>
                                        
                                    </tr>                                   										
                                       
								</table>

                                    

								</td>
								<td align="center" width="3%"></td>
							</tr>

							<tr>
								<td align="center" colSpan="3">
									<hr noShade="noshade" SIZE="1">
								</td>
                            </tr>
							
                            <tr>    
                                                     
								<td align="center" width="20%"></td>
                                
								<td align="center" width="60%" colSpan="2">
									<div id="vldSummary" class="vldSummary" style="width:958px;display:none;">

</div>
								</td>
								<td align="center" width="20%"></td>
                                
							</tr>
                           
							<tr>
								<td  valign="top" align="center" style="width:100%" colSpan="4" >                                    
									<hr />
									<a style="BORDER-BOTTOM-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none"
										href="http://www.njcrib.com">Home</a>
									<hr />
									<font face="Arial" size="1">
										<br>
										<br>
										<br>
										Copyright � 1997 - 2008 by NJCRIB<br>
										All Rights Reserved
										<br>
										<br>
									</font>
                                                               
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		
<script type="text/javascript">
//<![CDATA[
var Page_ValidationSummaries =  new Array(document.getElementById("vldSummary"));
var Page_Validators =  new Array(document.getElementById("rqdName"), document.getElementById("rqdDate"), document.getElementById("rglrEffDate"), document.getElementById("rglrDate"), document.getElementById("rglrCity"), document.getElementById("rglrState"));
//]]>
</script>

<script type="text/javascript">
//<![CDATA[
var rqdName = document.all ? document.all["rqdName"] : document.getElementById("rqdName");
rqdName.controltovalidate = "txtName";
rqdName.errormessage = "An Employer Name must be entered!";
rqdName.display = "Dynamic";
rqdName.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
rqdName.initialvalue = "";
var rqdDate = document.all ? document.all["rqdDate"] : document.getElementById("rqdDate");
rqdDate.controltovalidate = "txtDate";
rqdDate.errormessage = "An Accident Date must be entered!";
rqdDate.display = "Dynamic";
rqdDate.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
rqdDate.initialvalue = "";
var rglrEffDate = document.all ? document.all["rglrEffDate"] : document.getElementById("rglrEffDate");
rglrEffDate.controltovalidate = "txtDate";
rglrEffDate.errormessage = "The Date of Accident is Invalid, Please re-enter!";
rglrEffDate.display = "Dynamic";
rglrEffDate.evaluationfunction = "RegularExpressionValidatorEvaluateIsValid";
rglrEffDate.validationexpression = "^(?=\\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\\/|-|\\.)31)\\1|(?:(?:0?[1,3-9]|1[0-2])(\\/|-|\\.)(?:29|30)\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})|(?:0?2(\\/|-|\\.)29\\3(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\\/|-|\\.)(?:0?[1-9]|1\\d|2[0-8])\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2}))($|\\ (?=\\d)))";
var rglrDate = document.all ? document.all["rglrDate"] : document.getElementById("rglrDate");
rglrDate.controltovalidate = "txtDate";
rglrDate.errormessage = "Accident Date must be in MM/DD/YYYY format!";
rglrDate.display = "Dynamic";
rglrDate.evaluationfunction = "RegularExpressionValidatorEvaluateIsValid";
rglrDate.validationexpression = "(\\d\\d)/(\\d\\d)/(\\d\\d\\d\\d)";
var rglrCity = document.all ? document.all["rglrCity"] : document.getElementById("rglrCity");
rglrCity.controltovalidate = "txtCity";
rglrCity.errormessage = "City must be Alphabetic Only!";
rglrCity.display = "Dynamic";
rglrCity.evaluationfunction = "RegularExpressionValidatorEvaluateIsValid";
rglrCity.validationexpression = "^([a-zA-z\\s]{3,20})$";
var rglrState = document.all ? document.all["rglrState"] : document.getElementById("rglrState");
rglrState.controltovalidate = "txtState";
rglrState.errormessage = "Must use a State abbreviation only!";
rglrState.display = "Dynamic";
rglrState.evaluationfunction = "RegularExpressionValidatorEvaluateIsValid";
rglrState.validationexpression = "^[a-zA-Z]+$";
var vldSummary = document.all ? document.all["vldSummary"] : document.getElementById("vldSummary");
vldSummary.headertext = "Please fix the following errors:";
//]]>
</script>

<div class="aspNetHidden">

	<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="46886D68" />
	<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEdAAz4YjhRJBn+ukwoTcgVGeunVqMQhVUjmnalLoGe3KU4UptmKlDFcrlw6oSQUDslVbGjOglmm5fGSk5UkpFsfK4eQmTnPkxgOAq63YiVY5iwppYZRpDocmMDJ11EmXZJzAgrmtCHLRrNXCrKIKqPA4/Y0e8jaXD6bGe5WWlHrre4g8nFgSocznphOAJIZmk9+LQvYxE9WjteRYZnZ6vmmGUR+3vJtv+vtDVQ/SlRjHmZOMEkg3Thyaawpa0mXg7o55Cuser65B+tJFm/Kt6eVvbB5dq7gHjNO2MjEE8VDg2OXw==" />
</div>

<script type="text/javascript">
//<![CDATA[

var Page_ValidationActive = false;
if (typeof(ValidatorOnLoad) == "function") {
    ValidatorOnLoad();
}

function ValidatorOnSubmit() {
    if (Page_ValidationActive) {
        return ValidatorCommonOnSubmit();
    }
    else {
        return true;
    }
}
        
(function(id) {
    var e = document.getElementById(id);
    if (e) {
        e.dispose = function() {
            Array.remove(Page_ValidationSummaries, document.getElementById(id));
        }
        e = null;
    }
})('vldSummary');
WebForm_AutoFocus('txtName');Sys.Application.add_init(function() {
    $create(Sys.Extended.UI.CalendarBehavior, {"button":$get("imgCalendar"),"format":"MM/dd/yyyy","id":"calDate","popupPosition":3}, null, null, $get("txtDate"));
});

document.getElementById('rqdName').dispose = function() {
    Array.remove(Page_Validators, document.getElementById('rqdName'));
}

document.getElementById('rqdDate').dispose = function() {
    Array.remove(Page_Validators, document.getElementById('rqdDate'));
}

document.getElementById('rglrEffDate').dispose = function() {
    Array.remove(Page_Validators, document.getElementById('rglrEffDate'));
}

document.getElementById('rglrDate').dispose = function() {
    Array.remove(Page_Validators, document.getElementById('rglrDate'));
}

document.getElementById('rglrCity').dispose = function() {
    Array.remove(Page_Validators, document.getElementById('rglrCity'));
}

document.getElementById('rglrState').dispose = function() {
    Array.remove(Page_Validators, document.getElementById('rglrState'));
}
//]]>
</script>
</form>
	</body>
</HTML>

Open in new window

and then I put panels around each fieldset and set DefaultButton="btnBeginSearch" which is what Id like to run to give me the errors when they occur. Once again, it works in IE but not Firefox? Any clues?
ASKER CERTIFIED SOLUTION
Avatar of Russ Suter
Russ Suter

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Try:
    <script type="text/javascript" language="javascript">
	function sf() {  document.forms.Form1.txtName.focus();  }

        function showkey(e) {
			var event = e || window.event;
			var keyCode = event.keyCode ? event.keyCode || event.which;
			console.log( keyCode )
            if (keyCode == 13) {
                switch (document.activeElement.id) {
                    // txtname
                    case 'txtName': document.forms.Form1.btnBeginSearch.focus(); break;
                        // txtDate
                    case 'txtDate': document.forms.Form1.btnBeginSearch.focus(); break;
                        // txtCity
                    case 'txtCity': document.forms.Form1.btnBeginSearch.focus(); break;
                        // txtState
                    case 'txtState': document.forms.Form1.btnBeginSearch.focus(); break;
                        // txtState
                    case 'txtFileNumber': document.forms.Form1.btnBeginSearch.focus(); break;
                        // txtState
                    case 'txtFAccidentDate': document.forms.Form1.btnBeginSearch.focus(); break;
                        // btnBeginSearch
                    case 'btnBeginSearch': document.forms.Form1.btnBeginSearch.focus(); break;
                }
            }
        }
		
// Source: http://dustindiaz.com/rock-solid-addevent
function addEvent( obj, type, fn ) {
	if (obj.addEventListener) {
		obj.addEventListener( type, fn, false );
		EventCache.add(obj, type, fn);
	}
	else if (obj.attachEvent) {
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
		EventCache.add(obj, type, fn);
	}
	else {
		obj["on"+type] = obj["e"+type+fn];
	}
}

var EventCache = function(){
	var listEvents = [];
	return {
		listEvents : listEvents,
		add : function(node, sEventName, fHandler){
			listEvents.push(arguments);
		},
		flush : function(){
			var i, item;
			for(i = listEvents.length - 1; i >= 0; i = i - 1){
				item = listEvents[i];
				if(item[0].removeEventListener){
					item[0].removeEventListener(item[1], item[2], item[3]);
				};
				if(item[1].substring(0, 2) != "on"){
					item[1] = "on" + item[1];
				};
				if(item[0].detachEvent){
					item[0].detachEvent(item[1], item[2]);
				};
				item[0][item[1]] = null;
			};
		}
	};
}();

addEvent(window,'unload',EventCache.flush);
addEvent(document,'keydown', showkey);
    </script>

Open in new window

Avatar of jknj72
jknj72

ASKER

Russ, Im kinda new to javascript and need to know where I should put this code in order to make it work?

Hielo, I tried putting your code in place of the <script> I had in my markup but it didn't seem to work..

Just an fyi, one of my biggest hurdles is where to put the code that I get from some questions so if you could let me know where to put the code you give I would appreciate it.

Thanks
JK
Avatar of jknj72

ASKER

Thanks Russ!!
Avatar of jknj72

ASKER

I used your e.which in my script and now it runs in FF perfectly. Thank you