Rock Fact Generator

Rock facts are just lies that sound plausible, you can't just go around telling people dinosaurs had ears.

Anynomous, "on the subject of truth"

Rock facts are just that, lies that sound plausable. They also have a humorous angle to them. I made a simple webpage that spits out these lies like the Chuch Norris fact generators of the old web.Chuch norris fact generator

I'm not sure how these kinds of things used to work but this one is crazy simple. There is an array of facts and a function attached to a button that updates an element. Thats it, no need for anything fancy.

var rockFacts = ["this is a fact", "this is another"]
var numFacts= rockFacts.length;
var factIndex=0;
function rockfactgen()
    {
        prevFact=factIndex;
        factIndex=Math.floor(Math.random() * numFacts);
        if(factIndex==prevFact){
            factIndex=Math.floor(Math.random() * numFacts);}        
        
        document.getElementById("rockfact").innerHTML = rockFacts[factIndex];
         
        
    }


            

You can see the code here. Its nothing amazing, some of the facts are funny. If you want to add to the list of rockfacts you can email me at ihaveanewrockfact@gmail.com and I MIGHT remember to add them.

Emarian tales

An ambitious RPG system with a mostly fan based

Home Blog Articles Projects Ben and Tim