Common.js: Difference between revisions
From Necroxia Origin
mNo edit summary |
mNo edit summary |
||
Line 8: | Line 8: | ||
//var d = document.createElement('div'); | //var d = document.createElement('div'); | ||
$(this).append("<script src='MediaWiki:Common.js'></script>"); | |||
$(this).append("<table id='table1'></table>"); | $(this).append("<table id='table1'></table>"); | ||
for (i = 0; i < inputs.length; i++) { | for (i = 0; i < inputs.length; i++) { |
Revision as of 09:03, 1 September 2020
/* Any JavaScript here will be loaded for all users on every page load. */ $("#testdiv").each(function() { var parent = $(this); //var inputs = ['currentRoom', 'currentCount', 'answerNumber']; var inputs = [ ['currentRoom', 1, 32, 1, 'Escribe aqui el numero de la habitacion en que te encuentras:'], ['currentCount', 0, 999, 0,'Escribe aqui tu cuenta actual:'], ['answerNumber', 31, 93, 77,'Escribe aqui el numero al que necesitas llegar:'] ]; //var d = document.createElement('div'); $(this).append("<script src='MediaWiki:Common.js'></script>"); $(this).append("<table id='table1'></table>"); for (i = 0; i < inputs.length; i++) { $('#table1').append("<tr><td>"+inputs[i][4]+"</td><td><input type='number' id='" + inputs[i][0] + "' name='"+inputs[i][0]+"' min='"+inputs[i][1]+"' max='"+inputs[i][2]+"' value='"+inputs[i][3]+"' maxLength='4' style='width:70px'/></td></tr>"); //$(this).append("<input type='number' id='" + inputs[i][0] + "' name='"+inputs[i][0]+"' min='"+inputs[i][1]+"' max='"+inputs[i][2]+"' value='"+inputs[i][3]+"' maxLength='4' style='width:70px'/>"); $(this).append("<br> id="+inputs[i][0]+" name="+inputs[i][0]+" min="+inputs[i][1]+" max="+inputs[i][2]+" value="+inputs[i][3]); } $(this).append("<button onclick='getPossibleTeleports()'>getChance</button>"); var currentRoom = $('#currentRoom').val(); $(this).append("<br>"+currentRoom); $(this).append("<br> " + $("input[id=currentRoom]").value); }); function getPossibleTeleports() { var currentRoom = $('#currentRoom').val(); $(parent).append("<br>"+currentRoom); }