Widget:TriviaText: Difference between revisions

From Unforgotten Realms Wiki
Jump to navigationJump to search
imported>Pillowkeeper
mNo edit summary
imported>Pillowkeeper
No edit summary
Line 6: Line 6:
<li id="trivia5"></li>
<li id="trivia5"></li>
<script>
<script>
function boldHTML() {
  var element = document.createElement("b");
  element.innerHTML = "Bold text";
  return element;
}
window.addEventListener("load", function () {
window.addEventListener("load", function () {
var list = new Array();
var list = new Array();
list[0] = "/'/'/'[[Slippery Knuckles Malone]]/'/'/' does not recall his original name";
list[0] = "The term <b>\"No Tricks\"</b> originated in the season one campaign </b><a href=\"https://wiki.urealms.com/wiki/The_Jewel_of_the_Dingo_Isles\">The Jewel of the Dingo Isles</a></b>"
list[1] = "1";
list[1] = "'''[[Slippery Knuckles Malone]]''' does not recall his original name";
list[2] = "2";
list[2] = "2";
list[3] = "3";
list[3] = "3";
Line 22: Line 27:
var ul = document.getElementById("trivia" + j);
var ul = document.getElementById("trivia" + j);
var i = Math.floor(Math.random() * list.length);
var i = Math.floor(Math.random() * list.length);
ul.appendChild(document.createTextNode(list[i]));
 
ul.insertAdjacentHTML( 'beforeend', list[i] );
 
var index = list.indexOf(list[i]);
var index = list.indexOf(list[i]);
if (index > -1){
if (index > -1){

Revision as of 16:37, 22 December 2016

  • <script> function boldHTML() { var element = document.createElement("b"); element.innerHTML = "Bold text"; return element; } window.addEventListener("load", function () { var list = new Array(); list[0] = "The term \"No Tricks\" originated in the season one campaign <a href=\"https://wiki.urealms.com/wiki/The_Jewel_of_the_Dingo_Isles\">The Jewel of the Dingo Isles</a>" list[1] = "Slippery Knuckles Malone does not recall his original name"; 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 ul = document.getElementById("trivia" + j); var i = Math.floor(Math.random() * list.length); ul.insertAdjacentHTML( 'beforeend', list[i] ); var index = list.indexOf(list[i]); if (index > -1){ list.splice(index, 1); } } }); </script>