冒泡:
var attr=Array();
for(var i=0;i<=10;i++){
attr[i]=parseInt(prompt("请输入第"+(i+1)+"个数"))}
for(var x=0;x<=10;x++){
for(var y=x+1;y<=10;y++){
if(attr[x]<attr[y]){
var temp=attr[x];
attr[x]=attr[y];
attr[y]=temp} }
}
}for(var k in attr){
alert(attr[k])}
去重:
var attr=Array();
for(var i=0;i<=10;i++){
var x=prompt("请输入第"+(i+1)+"个数")
var status=false;
for(var y in attr){
if(attr[y]==x){
status=true}
}
if(status==true){continue;}
attr.push(x)
}for(var z in attr){
alert(attr[z])}
获取时间月份:
<div id="a"></div>
<script>
window.setInterval("app()",1000)
function app(){
var b=new Date();
document.getElementById("a").innderText=b.getFullYear+" "+(b.getMonth()+1)+" "+
b.getDate()+" "+b.getHours()+":"+b.getMinutes()+":"+b.getSeconds();}
</script>