输入框比较大小弹出较大值
<!DOCTYPE HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>函数</title>
<script type="text/javascript">
var a=prompt("输入数字");
var b=prompt("输入另一个数字");
function compare(a,b)
{
if(a>b)
{
return a;
}
else if(a<b)
{
return b;
}else
{return "两数相等"}
}
document.write(a+"和"+b+"的较大值是:"+compare(a,b));
</script>
</head>
<body>
</body>
</html>