推 kusoayan:試試看 for(;;): endfor ? 07/21 14:51
一樣囧~
<?php for($i=0;$i<$sum;$i++): ?>
<?php for($j=0;$j<=5;$j++): ?>
temp[<?=$i?>][<?=$j?>]= "<? echo $data[$i][$j] ;?>";
<?php endfor; ?>
<?php endfor; ?>
迴圈的架構應該沒有問題
是指說 為什麼上面的sum可以成功的改變為javascript變數
可是下面的temp[][]陣列東西"看似"有進去可是無法使用0.0?
麻煩了Orz
※ 編輯: timmy852111 來自: 120.109.100.195 (07/21 15:00)
推 kusoayan:喔~我誤會了 我以為是迴圈的程式跑錯= =" 07/21 15:11
唔...我在迴圈後面又加上一段測試用的document.write
結果發現好像是迴圈後面的東西無法執行出來= =
<?php for($i=0;$i<$sum;$i++){ ?>
<?php for($j=0;$j<=5;$j++){ ?>
temp[<?=$i?>][<?=$j?>]="<? echo $data[$i][$j] ;?>";
<?php } ?>
<?php } ?>
document.write("test2");
document.write(temp[2][2]);
執行後的網頁原始碼為
-- //節錄
temp[14][0]="019";
temp[14][1]="積善樓";
temp[14][2]="24.169211";
temp[14][3]="120.693903";
temp[14][4]="406";
temp[14][5]="臺中市北屯區興安路1段163號";
document.write("test2");
document.write(temp[2][2]);
--
可是上面那些全部都沒有在網頁上顯示出來 只有在原始碼內有= =
※ 編輯: timmy852111 來自: 120.109.100.195 (07/21 15:20)
推 Jerr:一句話 var arr = <? json_encode($array); ?>; 收工 07/21 16:13
→ timmy852111:好的 我再來研究看看Json @@" 07/21 17:48