You can accomplish this using localStorage. which is session based. (meaning it wont go away till the browser is closed).
you can use the localStorage object as a bucket to put vars you want to retain after refresh.
<div id="myFact"></div>
<script>
if (typeof(Storage) !== undefined) {
var myFact = new Array();
myFact[0] = "I have a dog";
myFact[1] = "My favorite sport is hockey";
myFact[2] = "I like chocolate";
myFact[3] = "Orange is my favorite color";
//var myRandom = Math.floor(Math.random()*myFact.length);
if (!localStorage.factIndex) {
localStorage.factIndex = 0;
} else {
localStorage.factIndex = (localStorage.factIndex >= (myFact.length-1)) ? 0: parseInt(localStorage.factIndex)+1;
}
document.getElementById('myFact').innerHTML = myFact[localStorage.factIndex];
} else {
//LocalStorage not supported with this browser
}
</script>