How can I make two random words appear by going over just one piece of text?
Hi,
I have been playing with the random question generator and what I want is for it to be able to pick a childs name at random and also pick a question at random, I have done it so far but what I want is instead of it being two pieces of text I have to roll over, is it possible to just have one and they make BOTH the name and the country appear? I've been playing with this but so far not found a solution.
Thanks.
This is the code:
Code:
<html>
<head>
<script language="JAVASCRIPT">
<!--
function pupilsname() {
pic = new Array();
pic = new Array();
pic[0] = "Adam Arnold";
pic[1] = "Brenda Beeston";
pic[2] = "Carl Carlton";
pic[3] = "Deborah Daybrook";
pic[4] = "Eric Eastwood";
pic[6] = "Francis Findern";
pic[7] = "Greg Grantham";
pic[8] = "Hilda Heanor";
pic[9] = "Ian Ilkeston";
pic[10] = "Jenny Japan";
pic[11] = "Keith Kimberley";
pic[12] = "Lucy London";
randomNum = Math.floor(Math.random()*pic.length);
return pic[randomNum];
}
// -->
<!--
function pupilsname2() {
pic = new Array();
pic = new Array();
pic[0] = "Australia";
pic[1] = "Belgium";
pic[2] = "China";
pic[3] = "Denmark";
pic[4] = "Estonia";
pic[6] = "France";
pic[7] = "Greece";
pic[8] = "Hungary";
pic[9] = "India";
pic[10] = "Japan";
pic[11] = "Korea";
pic[12] = "Lithuania";
randomNum = Math.floor(Math.random()*pic.length);
return pic[randomNum];
}
// -->
<!--
function tools() {
pic = new Array();
pic = new Array();
pic[0] = "Pick a name from the hat";
randomNum = Math.floor(Math.random()*pic.length);
return pic[randomNum];
}
// -->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<center>
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" bgcolor="#FFFFFFF"><table width="99%" height="220" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="60" colspan="2" align="center" valign="middle" bgcolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="middle"><font size="6" color="#000000"><strong>Big Wood School Random Name Generator</strong></font></td>
</tr>
</table></td>
</tr>
<tr>
<td width="50%" rowspan="2" align="center" valign="middle" bgcolor="#FFFFFF"><p> <a href="#"
onMouseOver="document.getElementById('myText1').innerHTML = pupilsname() ;" onMouseOut="document.getElementById('myText1').innerHTML = tools() ;""><font size="3"><font size=5><strong>Pick a pupil</strong></font></a>
</li>
</p>
<p> <a href="#"
onMouseOver="document.getElementById('myText2').innerHTML = pupilsname2() ;" onMouseOut="document.getElementById('myText2').innerHTML = tools() ;""><font size="3"><font size=5><strong>Pick a Country</strong></font></a>
</li>
</p></td>
<td width="50%" bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td align="left" valign="top" bgcolor="#FFFFFF"><font size="6" color="#000000">
<div id="myText1" onMouseOver="this.innerHTML = originaltext();">Pick a name from the hat</div>
<div id="myText2" onMouseOver="this.innerHTML = originaltext();">Pick a country from the hat</div>
</font></td>
</tr>
</table></td>
</tr>
</table>
</center>
</body>
</html>