That works, but I think the code below is a more elegant way to achieve the same effect - obviously alter the amount added to num each time, and the timeout, to achieve what you want exactly.
Code:
<html>
<head>
<script type="text/javascript">
function timedText(num)
{
document.getElementById('displayDiv').innerHTML=num + ' milliseconds!';
num=num+1;
setTimeout('timedText('+num+')',1);
}
</script>
</head>
<body>
<form>
<input type="button" value="Display timed text!" onClick="timedText(0)">
<div id="displayDiv">
<p>Click on the button above. It will tell you when two, four, and six seconds have passed.</p>
</div>
</body>
</html>