31 lines
845 B
HTML
31 lines
845 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Factorials</title>
|
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
|
<script>
|
|
$(function(){
|
|
$("#num").parent().append("<span id='result'></span>");
|
|
$("#submit").click(function() {
|
|
$.getJSON($("#num").attr("value") + "/", function(o) {
|
|
$("#result").text("fact(" + o.input + ") = " + o.result);
|
|
});
|
|
return false;
|
|
});
|
|
});
|
|
</script>
|
|
<style>
|
|
#result {
|
|
padding-left: 1em;
|
|
color: #090;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<form method="get" action="fact/">
|
|
<p><label for="num">Number:</label> <input type="text" id="num" name="num"></p>
|
|
<p><input id="submit" type="submit" value="Get the factorial!"></p>
|
|
</form>
|
|
</body>
|
|
</html>
|