谁给看看怎么弹不出来呢,哪里错了吗?谢谢!
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>取最值</title>
</head>
<body>
<script type="text/javascript">
var arr=[4,7,8,9,45,12,15,99];
function getMax(arr){
var max=0;
for(var x=1;x<=arr.length;x++)
{
if(arr[x]>arr[max])
max=x;
}
return aar[max];
}
var maxValue=getMax(arr);
alert("maxValue:"+maxValue);
</script>
</body>
</html> |