Created
May 18, 2012 11:50
-
-
Save kane-thornwyrd/2724858 to your computer and use it in GitHub Desktop.
Fond de différentes couleurs "au hasard" en JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
couleurs = [ | |
'ff0000' | |
'00ff00' | |
'0000ff' | |
] | |
m = Math | |
couleur_de_fond = couleurs[0] | |
cur = m.floor m.round m.random() * (couleurs.length - 1) | |
couleur_de_fond = couleurs[cur] | |
document.bgColor = couleur_de_fond |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var couleur_de_fond, couleurs, cur, m; | |
couleurs = ['ff0000', '00ff00', '0000ff']; | |
m = Math; | |
couleur_de_fond = couleurs[0]; | |
cur = m.floor(m.round(m.random() * (couleurs.length - 1))); | |
couleur_de_fond = couleurs[cur]; | |
document.bgColor = couleur_de_fond; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Fond de différentes couleurs "au hasard" en JS — Gist</title> | |
<script type="text/javascript"> | |
var couleur_de_fond, couleurs, cur, m; | |
couleurs = ['ff0000', '00ff00', '0000ff']; | |
m = Math; | |
couleur_de_fond = couleurs[0]; | |
cur = m.floor(m.round(m.random() * (couleurs.length - 1))); | |
couleur_de_fond = couleurs[cur]; | |
document.bgColor = couleur_de_fond; | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment