MediaWiki:Zerospace EN.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
$(function () { | $(function () { | ||
var | var generateButton = document.getElementById('generate_alien_button'); | ||
var generateOutput = document.getElementById('generate_alien_output'); | |||
generateButton.innerHTML = '<input onclick="generate_alien();" />' + | |||
'/**' + | |||
' * Generates a random alien.' + | |||
' *' + | |||
' * @access public' + | |||
' * @return string $random_alien Random alien' + | |||
' */' + | |||
'function generate_alien()' + | |||
'{' + | |||
' $random_alien = \'\';' + | |||
' $dice_size = 6;' + | |||
' ' + | |||
' srand((double)microtime()*1000000);' + | |||
' $random_alien = rand(1, $dice_size);' + | |||
' ' + | |||
' generateOutput.innerHTML =\'$random_alien\';' + | |||
'}' + | |||
''; | |||
}()); | }()); |
Revision as of 13:00, 25 April 2018
$(function () {
var generateButton = document.getElementById('generate_alien_button');
var generateOutput = document.getElementById('generate_alien_output');
generateButton.innerHTML = '<input onclick="generate_alien();" />' +
'/**' +
' * Generates a random alien.' +
' *' +
' * @access public' +
' * @return string $random_alien Random alien' +
' */' +
'function generate_alien()' +
'{' +
' $random_alien = \'\';' +
' $dice_size = 6;' +
' ' +
' srand((double)microtime()*1000000);' +
' $random_alien = rand(1, $dice_size);' +
' ' +
' generateOutput.innerHTML =\'$random_alien\';' +
'}' +
'';
}());