Well, I just gave you the basics, you didn't say how well you knew JS. So I'll assume you are a beginner - here is a full working version:
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>Untitled Page</title>
<script type="text/javascript"><!--
function generateRandom() {
rNum = Math.ceil(Math.random() * 3000);
document.form1.randNum.value = rNum;
}
//-->
</script>
</head>
<body bgcolor="#ffffff">
<form name="form1">
<input name="randNum" type="text">
<input type="button" value="Generate" onclick="generateRandom();">
</form>
</body>
</html>
Last edited by funkdaddu : 08-01-2006 at 01:42 PM.
|