Re: Enter must acitvate a button

From: Date: Mon, 15 Oct 2001 04:45:52 +0000
Subject: Re: Enter must acitvate a button
Groups: php.general 
Request: Send a blank email to php-general+get-71061@lists.php.net to get a copy of this message
Hi! De Necker, It is possible if u remove the action associated with the button __ Onclick="function()";__ keep this function in <form name="formname" Onsubmit="function()"> and button should be like this <input type="submit" value="SUBMIT"> Example: ___________________________________________________________________________ _______________ <!DOCTYPE html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <HEAD> <TITLE>IMAC</TITLE> <meta http-equiv="Expires" CONTENT="0"> <meta http-equiv="Cache-Control" CONTENT="no-cache"> <meta http-equiv="Pragma" CONTENT="no-cache"> </HEAD> <SCRIPT language="Javascript"> function check(){ if (document.login.emp_id.value=='' || document.login.emp_id.value=='0') { alert('Please enter your employee number'); document.login.emp_id.focus(); return false; } else if(document.login.emp_pass.value=='') { alert("Please enter the password"); document.login.emp_pass.focus(); return false; } else { document.login.method = "POST"; document.login.action="./authentication.php"; document.login.submit(); return true; } } </script> </head> <body text="arial" background="imacbg1.gif" style="width:100%;overflow-x:hidden;overflow-y:scroll" ONLOAD="document.login.emp_id.focus()"> <font face="arial" > <center> <h1> WELCOME TO IMAC TOOL </h1></center> <center> <img SRC="logo.gif" height=100 width=100></img> <form name="login" onSubmit="return check()"> <table border="0" width="100%"> <center> <tr><td width="50%" align="right"><b><font size="2" face="Arial">Employee No&nbsp;</font></b></td><td width="5%"></td><td width="50%"><input type="text" size="10" name="emp_id" maxlength="10" value=""></td></tr> <tr><td width="50%" align="right"><b><font size="2" face="Arial">Password&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></b>< /td><td width="5%"></td><td width="50%" ><input type="password" size="10" name="emp_pass" maxlength="10" value=""></td></tr> <tr> <td width="50%" align="right"> <p align="left"> </td> <td width="5%"> </td> <td width="50%"> <p align="left"> <input type="submit" Value="LOGIN"></td> </tr> </center> </table> <br/><br/><br/> <b><font size="3" face="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Note:- Best viewed in Internet Explorer 5.0.<br> </font></b> </center> </form> </body></html> ___________________________________________________________________________ Hope this helps.. regards -Balaji ----- Original Message ----- From: De Necker Henri <deNeckerH@ford.co.za> To: PHP-General (E-mail) <php-general@lists.php.net> Sent: Friday, October 12, 2001 5:28 PM Subject: [PHP] Enter must acitvate a button I need help with a button What i what to do is let the user either click on the submit button or just press enter without pressing TAB to get to the button. The user enters a id.no. in a textfield & then must only be able to press enter without pressing a other key or TAB. U will see when one enters data into a text field the first button highlights up at its border. Now i want to press only enter to activate that button. Can someone help me?

----------------------------------------------------------------------------------------------------------------------- Information transmitted by this E-MAIL is proprietary to Wipro and/or its Customers and is intended for use only by the individual or entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at mailto:mailadmin@wipro.com and delete this mail from your records. ------------------------------------------------------------------------------------------------------------------------
« previous php.general (#71061) next »