MediaWiki:Zerospace EN.js: Difference between revisions

From OGC
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
   var generateOutput = document.getElementById('generate_alien_output');
   var generateOutput = document.getElementById('generate_alien_output');


   generateButton.innerHTML = '<input onclick="generate_alien();" />' +  
   generateButton.innerHTML = '<input type="button" value="GO" onclick="generate_alien();" />' +  
       '/**' +
       '/**' +
       ' * Generates a random alien.' +
       ' * Generates a random alien.' +

Revision as of 13:01, 25 April 2018

$(function () {

  var generateButton = document.getElementById('generate_alien_button');
  var generateOutput = document.getElementById('generate_alien_output');

  generateButton.innerHTML = '<input type="button" value="GO" 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\';' +
      '}' +
      '';

}());