Write a function that takes an integer value and returns the number with its digits reversed. For example, given the number 7631, the function should return 1367. Incorporate the function into a script that reads a value from the user. Display the result of the function in the status bar.

<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title> Reverse </title>
<script type="text/javascript">
<!--
function reverse()
{
var b=0;
var num = document.getElementById("digit").value;
var ans;
while(parseInt(num) > 0)
{
b= b * 10;
b= b + parseInt(num % 10)
num =parseInt(num / 10);
}
window.status="Reverse Digit:" + b;
document.getElementById("ans").value=b;
}
// -->
</script>
</head>
<body>
<h1>ReverseIt</h1>
<hr />

<p>Press F5 or Refresh to load script again. This is a program to Reverse the input numbers</p>
<form name = "multiply" action = "">
<table border = "1">
<caption>ReverseIt</caption>
<tr><td>Input Digits</td>
<td><input name = "digit" type = "text" />
</td></tr>

<tr><td>Reverse Digits</td>
<td><input name = "ans" type = "text" disabled="disabled" />
</td></tr>
<tr><td><input type = "button" value = "ReverseIt"
onclick = "reverse()" /></td></tr>
</table>
</form>
</body>
</html>