Zone Webmasters - Chaine aléatoire en JavaScript

> Accueil > Codes sources > Code sources JavaScript > Images > Chaine aléatoire en JavaScript

Chaine aléatoire en JavaScript

Par: Crocxx | Categorie: Images

Description

Petite fonction javaScript qui permet de générer une chaine de caractère aléatoire.

Code source

<script type="text/javascript">
<!--
var ChaineAleatoire = function ChaineAleatoire(nbcar)
{
	var ListeCar = new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9");
	var Chaine ='';
	for(i = 0; i < nbcar; i++)
	{
		Chaine = Chaine + ListeCar[Math.floor(Math.random()*ListeCar.length)];
	}
	return Chaine;
}
-->
</script>


Imprimer ce code source




Commentaires

Commentaires



aucun commentaire

Ajouter un commentaire

Vous devez être membre pour commenter ce code source.

>> Inscrivez vous



Faire un lien | Partenaires ©2005-2008 Rudy Onfroy Tous droits réservés Contact | RSS | Plan | Haut