MediaWiki:Zerospace EN.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
/** | |||
* 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); | |||
return $random_alien; | |||
} | |||
function get_alien() | |||
{ | |||
echo generate_alien(); | |||
} | |||
$(function () { | $(function () { | ||
Line 4: | Line 28: | ||
var generateOutput = document.getElementById('generate_alien_output'); | var generateOutput = document.getElementById('generate_alien_output'); | ||
generateButton.innerHTML = '<input type="button" value="GO" onclick=" | generateButton.innerHTML = '<input type="button" value="GO" onclick="get_alien();" />'; | ||
}()); | }()); |
Revision as of 13:06, 25 April 2018
/**
* 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);
return $random_alien;
}
function get_alien()
{
echo generate_alien();
}
$(function () {
var generateButton = document.getElementById('generate_alien_button');
var generateOutput = document.getElementById('generate_alien_output');
generateButton.innerHTML = '<input type="button" value="GO" onclick="get_alien();" />';
}());