dimanche 1 mars 2015

load random word from 2 arrays and combine them in a single click

okay so I am trying to make a single call to load 1 word from 2 different arrays in javascript


so the end result would be "round bubble" or "aromatic things"


this is what I have



<script type="text/javascript">
function getDesc() {
var descr = new Array["straight", "round", "aromatic");
var randomChoice = Math.floor(Math.random()* descr.length)
}
function getNoun() {
var nouns = new Array("bubble", "office", "things");
var randomChoice = Math.floor(Math.random()* nouns.length)
}

function getWords() {
getDesc();
getNoun();
}
</script>


<div id="myBox">
Words load here
</div>

<P>
<a href="javascript:getWords()">Button</a>
</p>




Aucun commentaire:

Enregistrer un commentaire