»
AnglaisFran�aisVietnamien

Imprimer - Nom Capitalisation - JavaScriptBank.com

Version compl�te: jsB@nk » Form » Textarea » Nom Capitalisation
URL: https://www.javascriptbank.com/name-capitalization.html

Nom Capitalisation © JavaScriptBank.comCet JavaScript ajuste la capitalisation des noms (en fait, le contenu de tout forme domaine de l'application de celle-ci) de sorte que la première lettre de chaque mot en majuscule et le reste en minuscule. C'est si facile à mettre en oeuvre!

Version compl�te: jsB@nk » Form » Textarea » Nom Capitalisation
URL: https://www.javascriptbank.com/name-capitalization.html



JavaScript
<script language="javascript">/*Created by: Will Bontrager | http://bontragerconnection.com/*/// Two values need to be specified, the form name and the //   field name to be processed.var FormName = "myform";var FieldName = "name";function CapitalizeNames() {  var ValueString = new String();  eval('ValueString=document.'+FormName+'.'+FieldName+'.value');  ValueString = ValueString.replace(/ +/g,' ');  var names = ValueString.split(' ');  for(var i = 0; i < names.length; i++) {    if(names[i].length > 1) {   names[i] = names[i].toLowerCase();   letters = names[i].split('');    letters[0] = letters[0].toUpperCase();   names[i] = letters.join('');  } else { names[i] = names[i].toUpperCase(); }  }  ValueString = names.join(' ');  eval('document.'+FormName+'.'+FieldName+'.value=ValueString');  return true;}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form name="myform">  Your name: <input type="text" name="name">  <input type="button" value="Click" onclick="return CapitalizeNames();"></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->