MediaWiki:Zerospace EN.js: Difference between revisions

From OGC
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
function alert_test()
function generate_alien()
{
{
     var random_alien = '';
     var random_alien = '';
Line 5: Line 5:


     random_alien = Math.floor((Math.random() * dice_size) + 1);
     random_alien = Math.floor((Math.random() * dice_size) + 1);
     document.getElementById("test_output").innerHTML = random_alien;
     document.getElementById("random_alien_output").innerHTML = 'Your Random Alien';
    document.getElementById("random_alien_output").innerHTML = random_alien;


     alert("Test!");
     alert("Test!");
Line 12: Line 13:
$(function () {
$(function () {


  var test_button = document.getElementById('test_button');
    var random_alien_title = document.getElementById('random_alien_title');
 
    var random_alien_button = document.getElementById('random_alien_button');
  test_button.innerHTML = '<input type="button" value="Test" onclick="alert_test();" />';


    random_alien_title.innerHTML = 'Create An Alien';
    random_alien_button.innerHTML = '<input type="button" value="Generate An Alien" onclick="generate_alien();" />';
}());
}());

Revision as of 14:15, 25 April 2018

function generate_alien()
{
    var random_alien = '';
    var dice_size = 6;

    random_alien = Math.floor((Math.random() * dice_size) + 1);
    document.getElementById("random_alien_output").innerHTML = 'Your Random Alien';
    document.getElementById("random_alien_output").innerHTML = random_alien;

    alert("Test!");
}

$(function () {

    var random_alien_title = document.getElementById('random_alien_title');
    var random_alien_button = document.getElementById('random_alien_button');

    random_alien_title.innerHTML = 'Create An Alien';
    random_alien_button.innerHTML = '<input type="button" value="Generate An Alien" onclick="generate_alien();" />';
}());