Désactiver la touche entrer dans un textarea

Description

ce script permet de désactiver la touche Entrer dans un TextArea.

Source / Exemple :


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<html>
<head>
<title>Document sans nom</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.Style1 {
	color: #000000;
	font-size: 10px;
	font-family: Geneva, Arial, Helvetica, sans-serif;
	font-weight: bold;
}
-->
</style>
<script language="javascript1.2">
function BloqSubmit() 
{  
if (window.event.type == "keypress" & window.event.keyCode == 13) 
  {
 alert("attention ! la touche Entrer est désactivée")
    event.returnValue = false
  }
}  

</script>
</head>

<body>
<table width="750" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="218" height="87">&nbsp;</td>
    <td width="324">&nbsp;</td>
    <td width="208">&nbsp;</td>
  </tr>
  <tr>
    <td height="198">&nbsp;</td>
    <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <!--DWLayoutTable-->
        <tr>
          <td width="274" height="24" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#66CCFF">
              <!--DWLayoutTable-->
              <tr>
                <td width="12" height="4"></td>
                <td width="262"></td>
              </tr>
              <tr>
                <td height="12"></td>
                <td valign="top"><span class="Style1">Cliquer sur la toucher entrer </span></td>
              </tr>
              <tr>
                <td height="8"></td>
                <td></td>
              </tr>
                                  </table></td>
      <td width="50">&nbsp;</td>
        </tr>
        <tr>
          <td height="152" colspan="2" valign="top"><form name="form1" method="post" action="">
          <textarea name="textarea" cols="50" rows="10" class="Style1" onKeyPress="BloqSubmit()"></textarea>
          </form></td>
      </tr>
        <tr>
          <td height="22">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
    </table></td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>

Conclusion :


j'espere que ce script vous sera utile.

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.