Fonte Aleatoria em JavaScript
- Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml" xml:lang="pt-br" lang="pt-br">
<head>
<title>Fonte aleatória</title>
<meta name="author" content="Gabriel Barros | www.gabrielbarros.com.br" />
</head>
<body>
<script type="text/JavaScript">
<!--
var tipo = new Array()
tipo[0]= "Courier New";
tipo[1]= "Arial";
tipo[2]= "Arial Narrow";
tipo[3]= "Trebuchet MS";
tipo[4]= "Monotype Corsiva";
tipo[5]= "Times New Roman";
tipo[6]= "Comic Sans MS";
tipo[7]= "Verdana";
tipo[8]= "Calisto MT";
tipo[9]= "Tempus Sans ITC";
tipo[10]= "Impact";
var fonte = Math.round(Math.random() * 10);
document.write("<span style=\"font: 15px " + tipo[fonte] + "\">SEU-TEXTO</span>");
//-->
</script>
</body>
</HTML>
SEU-TEXTO = Este será o texto que ira mudar de fonte.
Resultado: Este Script faz com que o texto mude de fonte aleatoriamente sempre que a Página for atualizada.