<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> body{ background-color:gray; } </style> <script> function majuscule(lui){ lui.value=lui.value.charAt(0).toUpperCase() + lui.value.substr(1, lui.value.length-1).toLowerCase(); } </script> </head> <body> <input type="text" oninput="majuscule(this)" name="nom" size="52" maxlength="526"> <input type="text" oninput="this.value=this.value.charAt(0).toUpperCase() + this.value.substr(1, this.value.length-1).toLowerCase();" name="nom" size="52" maxlength="526"> </body> </html>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> body{ background-color:gray; } </style> <script> function majuscule(lui){ var tb=lui.value.split(" ") var modif="" for(var i=0;i<tb.length;i++){ tb[i]=tb[i].charAt(0).toUpperCase() + tb[i].substr(1, tb[i].length-1).toLowerCase(); modif+= i==tb.length-1 ? tb[i] : tb[i]+" " } lui.value=modif } </script> </head> <body> <input type="text" oninput="majuscule(this)" onchange="majuscule(this)" name="nom" size="52" maxlength="526"> </body> </html>