guys would you check this code out ?? I'm new in javascript. i dont know whats wrong with this code it works just after a refresh on firefox and dosen't work on chrome.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p id="txt"></p>
<input id="num" type="text" value="Type a number">
<!--Javascript starts-->
<script>
var num = document.getElementById("num").value;
function count()
{
for(i = 0; i<=num; i++)
{
document.write("Number: "+i+" <br/>");
}
}
</script>
<!--End of Javascript-->
<button onclick="count()">Click on me</button>
</body>
</html>