vedi se va
Codice PHP:
[url="java-script:void(0)"]Bottone[/url]
<script type="text/javascript">
var text = new Array();
text[0] = "testo 1";
text[1] = "testo 2";
text[2] = "testo 3";
var footnotes = new Array();
footnotes[0] = "nota 1";
footnotes[1] = "nota 2";
footnotes[2] = "nota 3";
var quips = [];
quips[0] = "bottone 1";
quips[1] = "bottone 2";
quips[2] = "bottone 3";
$("#quip").click(
function(){
//genero l'indice casuale
index = Math.floor(Math.random() * (text.length)) + 1;
$('#text').html(text[index]);
$('#footnote').html('[url="' + footnotes[index] + '"]' + footnotes[index] + '[/url]');
$('#index').html('#' + index);
$(this).text( quips[index] );
}
)
</script>