[問題] 為什麼document.write印出來的東西在另一頁?
小弟想寫一個簡易猜數字網頁
在印出幾A幾B的時候
居然會跳到一個新的網頁~
不知道這是為什麼呢??
片段程式碼如下
function tip()
{
acount=0;
bcount=0;
if(flag==0){
answer = new Array();
answer[0]=2;
answer[1]=5;
answer[2]=3;
answer[3]=8;
}
else{
question();
flag=0;
}
tr = new Array();
tr[0]=document.jayc.a.value;
tr[1]=document.jayc.b.value;
tr[2]=document.jayc.c.value;
tr[3]=document.jayc.d.value;
if(tr[0]==answer[0] && tr[1]==answer[1] && tr[2]==answer[2] && tr[3]==answer[3]){
alert("答對囉!");
return;
}
for(i=0;i<4;i++){
if(tr[i]==answer[i]){
acount++;
}
}
for(i=0;i<4;i++){
for(j=0;j<4;j++){
if(tr[i]==answer[j]){
bcount++;
}
}
}
bcount=bcount-acount;
document.write(""+acount+" A "+bcount+"B");
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.114.223.147
推
10/31 22:29, , 1F
10/31 22:29, 1F
→
10/31 22:29, , 2F
10/31 22:29, 2F
→
10/31 22:29, , 3F
10/31 22:29, 3F
→
11/01 07:32, , 4F
11/01 07:32, 4F
推
11/02 14:02, , 5F
11/02 14:02, 5F