Det skal du nok bruge AJAX til, men vi kan jo snyde lidt og bruge et skjult IFrame.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
http://www.w3.org/TR/html4/strict.dtd"><html>
<head>
<title>Tilfældigt tal</title>
</head>
<body>
<script type="text/javascript">
var aNotes=["Han skød ved siden af!","Han brændte!"];
var aScore=[0,0];
var iSec=0;
function newScore(){
var o=document.getElementById("randomscore");
var iRnd=Math.floor(Math.random()*2);
var iScore=Math.floor(Math.random()*2);
var iNote=Math.floor(Math.random()*aNotes.length);
aScore[iRnd]+=iScore;
o.firstChild.nodeValue=aScore.join("-");
if(!iScore){
document.getElementById("randomnote").appendChild(document.createTextNode(aNotes[iNote]));
}else{
document.getElementById("randomnote").appendChild(document.createTextNode("Der blev scoret!"));
}
document.getElementById("randomnote").appendChild(document.createElement("br"));
window.setTimeout("newScore()",(Math.floor(Math.random()*570)+30)*1000);
}
function updateTime(){
iSec++;
document.getElementById("timepassed").firstChild.nodeValue=Math.floor(iSec/60)+" min., "+iSec%60+" sek.";
}
function sendScore(){
document.getElementById("hiddeniframe").setAttribute("src","saverandom.htm?rnd=45&eh="+aScore.join("-"));
}
window.setTimeout("newScore()",(Math.floor(Math.random()*570)+30)*1000);
window.setInterval("updateTime()",1000);
window.setTimeout("sendScore()",900000);
</script>
<div>Resultat: <span id="randomscore">0-0</span> | <span id="timepassed">0 min., 0 sek.</span></div>
<br>
<div id="randomnote"></div>
<iframe id="hiddeniframe"></iframe>
</body>
</html>