就是利用数组自带滴排序,没啥好讲滴!至于各种排序算法自己看书吧,哈L@_@K<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>Max Number</title>
  <meta name="generator" content="editplus" />
  <meta name="author" content="[email protected]" />
  <meta name="keywords" content="javascript" />
  <meta name="description" content="for javascript region of csdn" />
 </head> <body>
  <script type="text/javascript">
  <!--
function descSort(x, y) {
  return x == y ? 0 : (x > y ? -1 : 1);
}function max(a, b, c)
{
    var arr = new Array(a, b, c);
    arr.sort(descSort);
    return arr[0];
}alert("max is " + max(4, 16, 8));
  //-->
  </script>
 </body>
</html>

解决方案 »

  1.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
     <HEAD>
      <TITLE> New Document </TITLE>
      <META NAME="Generator" CONTENT="EditPlus">
      <META NAME="Author" CONTENT="">
      <META NAME="Keywords" CONTENT="">
      <META NAME="Description" CONTENT="">
     </HEAD> <BODY>
      <script language="javascript">
    function max(a,b,c){
    return  a > (b > c ? b :c ) ? a :  (b > c ? b :c );
    } alert(max(5,2,3));
      </script> </BODY>
    </HTML>