Labels

Cerpen (18) html (16) movie (10) modul (7) SAP Security (2) c++ (2) Business (1)

Monday, 22 February 2016

html kod untuk shuffle nombor rawak

dapat nombor rawak

<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Random Number</title>
<style type="text/css" rel="stylesheet">
body { text-align:center }
div {
text-align: center;
font-size:40px;
}
</style>
<script type = "text/javascript">
<!--
function lucky() {
var message, start, end, output, luckyNumber;
start = parseInt(document.getElementById("start").value);
end = parseInt(document.getElementById("end").value);
output = document.getElementById("display");
luckyNumber = Math.floor(Math.random() * (end - start + 1)) + start;
output.innerHTML = luckyNumber;
}
//-->
</script>
<body>
<form action="javascript:lucky()">
<label>Starting Number </label>
<input type = "text" id= "start" size="3" value="100" />
<label>Ending Number</label>
<input type = "text" id= "end" size="3" value="200"/>
<input type="submit" value="LUCKY NUMBER" />
</form>
<div id="display">Lucky Draw!!!</div>
</body>
</html>

No comments:

Post a Comment