Frases Aleatorias II
Frases Aleatorias II
Frases Aleatorias II
Este script exibe uma frase aleatria a cada vez que a pgina
carregada.
Seguem os passos de como fazer para criar um widget com suas
prprias frases.
1. Defina as frases
Entre as tags <head> e </head> coloque os seguinte cdigo:
<script language='JavaScript' type='text/JavaScript'>
function makeQuote() {
Q = new Array();
Q[0] = "<i>Assim como o sol derrete o gelo, a gentileza evapora
mal-entendidos, desconfianas e hostilidade.</i>Albert Schweitzer"
Q[1] = "<i> impossvel fazer qualquer coisa prova de tolos,
porque os tolos so muito engenhosos.</i>Arthur Bloch"
Q[2] = "<i>Quem ama cr no impossvel.</i> Elisabeth B.
Browning"
index = Math.floor(Math.random() * Q.length);
document.writeln(Q[index]);
}
</script>
</head>
2. Folha de estilos
Entre as tags <style> e </style> (qualquer site) ou entre
<b:skin><![CDATA[/* e ]]></b:skin> (Blogger) insira o cdigo:
#newquote {color:gray; font-family:verdana; font-size:11px; textalign:right; padding:5px;}
#newquote i {display:block; color:black; font-family:georgia,
trebuchet ms; font-size:13px;}
#newquote small {display:block; text-align:right; margintop:10px;}
]]></b:skin>
Observe que voc pode utilizar seu conhecimento de CSS para
personalizar seu widget como achar melhor.
3. Insira o widget
No local de seu blog onde deseja que a frase aleatria aparea,
insira o seguinte cdigo:
<div id='newquote'>
<script language="javascript">
makeQuote();
</script> </div>
Deve ficar parecido com isso:
Frases Aleatorias
<html>
<head>
<title>Random Quote Demo</title>
<meta name="robots" content="nofollow,noindex">
</head>
<body link="#ff0000" vlink="#ff0000" alink="#ff0000"
onload="self.focus()" scroll="auto">
<br>
<center>
<font color="#0000FF" size="4" face="Verdana,Arial">
<script language="JavaScript">
//
==============================================
// Copyright 2004 by CodeLifter.com
// Free for all; but please leave in this header.
//
==============================================
// ======================================
// Do not change anything below this line
// ======================================
var Q = Quotation.length;
var whichQuotation=Math.round(Math.random()*(Q-1));
function showQuotation()
{document.write(Quotation[whichQuotation]);}
showQuotation();
</script>
</font>
<br>
<br>
<br>
<font color="#ff0000" size="1" face="Verdana,Arial">
{ <a href="randomquotePop.html">refresh page</a> }
</font>
</center>
</body>
</html>