<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>函数练习</title>
<script type="text/javascript">
function comValue(x1,x2)
{
var x1=document.getElementById('text1').value;
var x2=document.getElementById('text2').value;
if(x1>x2)
{
document.write(x1+"比较大")
}
else if(x1<x2)
{
document.write(x2+"比较大")
}
else
{
document.write("一样大")
}
}
</script>
</head>
<body>
<input id="text1" type="txt" value="请输入数字">
<input id="text2" type="txt" value="请输入第二个数字">
<input id="btn1" type="button" value="比较" onclick="comValue()">
</body>
</html>