熟悉PHP和JavaScript的大哥,近来帮我看一下问题.

 所属目录:Java   |   类型:技术问答   |   时间:2007-05-21
 问题:

<table   border="0"   cellpadding="0">  
  <caption><strong><?=$title;?></strong></caption>  
  <tr>  
  <td   width="100%"><img   src="51010.jpg"   width="300"   height="240"   name="photoslider"></td>  
  </tr>  
  <tr>  
  <td   width="100%">  
  <div   align="center"><center><p><script   language="javascript1.1">  
  var   photos=new   array()  
  var   which=0   ;  
   
   
  /*change   the   below   variables   to   reference   your   own   images.   you   may   have   as   many   images   in   the   slider   as   you   wish  
  photos[0]="51010.jpg"  
  photos[1]="51089.jpg"  
  photos[2]="mr.lin.bmp"  
  photos[3]="plane4.gif"  
  photos[4]="plane5.gif"*/  
   
  for   (which=0;which<<?=$size;?>   ;which=which+1   )  
  {  
  //photos[whice]=<?   foreach($photo   as   $v):   ?>pic/+<?=$v;?><?   endforeach;   ?>  
  photos[which]=<?   foreach($photo   as   $v):   ?><?=$v;?><?   endforeach;   ?>  
  }  
   
   
  function   backward(){  
  if   (which>0){  
  window.status=  
  which--  
  document.images.photoslider.src=photos[which]  
  }  
  }  
   
  function   forward(){  
  if   (which<photos.length-1){  
  which++  
  document.images.photoslider.src=photos[which]  
  }  
  else   window.status=end   of   gallery  
  }  
  </script><input   type="button"   value="<<back"   name="b2"  
  onclick="backward()">   <input   type="button"   value="next>>"   name="b1"  
  onclick="forward()"><br>  
  <a   href="#"   onclick="which=1;backward();return   false"><small>start   over<?=$size;?></small></a></p>  
  </center></div>  
  </td>  
  </tr>  
  </table>  
  --------------------------------------------------------------------------------  
   
  郁闷photos[which]=<?   foreach($photo   as   $v):   ?><?=$v;?><?   endforeach;   ?>  
  photos[which]循环不出  
  http://surge.servercorp.com/~qiye/index.php?module=test&action=form  
  这个是用js写的图片浏览器,我上传图片,自动把文件名传到js的数组里.  
  各位大哥,帮我看看

· 网友精彩回答:

发表者:huaan_9527

for   (which=0;which<<?=$size;?>   ;which=which+1   )  
  {  
  //photos[whice]=<?   foreach($photo   as   $v):   ?>pic/+<?=$v;?><?   endforeach;   ?>  
  photos[which]=<?   foreach($photo   as   $v):   ?><?=$v;?><?   endforeach;   ?>  
  }  
  ------------------------------  
  重复循环了吧

发表者:xuzuning

没有看到$photo   的定义

发表者:ice_berg16

你比较一下输出就知道了

.
处理 SSI 文件时出错
© 2006-2008 All Rights Reserved