Widget:TriviaText: Difference between revisions

From Unforgotten Realms Wiki
Jump to navigationJump to search
imported>Pillowkeeper
m Testing widgets
imported>Pillowkeeper
mNo edit summary
Line 1: Line 1:
<div id="trivia"></div>
<script>
<script>
window.addEventListener("load", function () {
window.addEventListener("load", function () {
Line 16: Line 17:
for (j = 0; j < 6; j++){
for (j = 0; j < 6; j++){
var i = Math.floor(Math.random() * list.length);
var i = Math.floor(Math.random() * list.length);
document.write("<li>" + list[i] + "</li>");
document.getElementById("trivia").innerHTML = "* " + list[i];
var index = list.indexOf(list[i]);
var index = list.indexOf(list[i]);
if (index > -1){
if (index > -1){
Line 23: Line 24:
}
}
});
});
</script>

Revision as of 16:05, 22 December 2016

<script> window.addEventListener("load", function () { var list = new Array();

list[0] = "0"; list[1] = "1"; list[2] = "2"; list[3] = "3"; list[4] = "4"; list[5] = "5"; list[6] = "6"; list[7] = "7"; list[8] = "8";

var fin = list.length; for (j = 0; j < 6; j++){ var i = Math.floor(Math.random() * list.length);

document.getElementById("trivia").innerHTML = "* " + list[i];

var index = list.indexOf(list[i]); if (index > -1){ list.splice(index, 1); } } });