出不来,求大神告知原因,本人刚自学,遇到问题实在不知道错在哪
<head>
<script>
var seat=[true,false,true,false,false];
function initSeats(){
for (var i=0;i<seat.length;i++){
if(seat[i]){
document.getElementById("seat"+i).src="true.jpg";
document.getElementById("seat"+i).alt="可用座位"
}
else{
document.getElementById("seat"+i).src="false.jpg";
document.getElementById("seat"+i).alt="已被选择的座位"
}
}
var selseat=i+1;
function findseat(){
if (selseat>=0) {selseat=-1;initSeats()};
for(var i=0;i<seat.length;i++){
if(seat[i]){selseat=i;
document.getElementById("seat"+i).src="true.jpg";
document.getElementById("seat"+i).alt="你的座位";
var accept=confirm("seat"+(i+1)+"是可用的,选择它?");
if(!accept){selseat=-1;
document.getElementById('"seat"+i').src="false.jpg";
document.getElementById('"seat"+i').alt="该座位已被选择";
}
}
}
};
}
</script>
</head>
<body onload="initSeats();">
<div style="margin-top:75px; text-align:center">
<img style="width:100px;height:100px;" id="seat0" src="" alt="" />
<img style="width:100px;height:100px;" id="seat1" src="" alt="" />
<img style="width:100px;height:100px;" id="seat2" src="" alt="" />
<img style="width:100px;height:100px;" id="seat3" src="" alt="" />
</div>
<br>
<button onClick="findseat()">查找座位</button>
</body>