<html> <head> <title>冒泡排序</title> <script type="text/javascript" language="javascript"> var str=new Array("8","3","5","7","1"); for(var i=0;i<str.length;i++){ for(var j=i+1; j<str.length;j++){ if(str[i]>str[j]) {var m; m=str[i];str[i]=str[j];str[j]=m; } } } alert(str); </script> </head> </body> </html>
已有0条评论