日期:2014-05-17  浏览次数:21273 次

大家帮我看一下,问题出在哪里
<%  
dim   k,root()
k=0
set   rs_pic=   Server.CreateObject( "adodb.recordset ")
sql_pic= "select   *   from   pic   order   by   uptime   desc "
rs_pic.open   sql_pic,conn,1,1
  rs_pic.movefirst%>
  <%     if   rs_pic.eof   and   rs_pic.bof   then
Response.Write " <p   align= 'center '> 没有相片 "  
%>
<%   Else%>  
<%     for   k=0   to   9  
k=k+1
redim   preserve   root(k)  
root(k)=rs_pic( "lujin ")
rs_pic.movenext
%>
  <%   if   rs_pic.eof   then   exit   for   %>
<%   next   %>
<%   End   If   %>
    <%   rs_pic.close
                    set   rs_pic=nothing   %>

<marquee   scrollamount= "4 "   scrolldelay= "100 "   direction= "left ">
    <script   language= "JavaScript "   type= "text/javascript ">
  function   checkpic(ap){
    var   j
    if   (ap)!== " "){
    for   (j=0   ;j <10;j++)
    {
    document.write   " <img   name= "picimage "   id= "image "   src= " <%=root(j)%> "   width= "10% "   height= "72 "   alt= " "   /> "}
    }
    }
    </script>
    <script   language= "JavaScript "   type= "text/javascript "> checkpic(root) </script>
</marquee>


附在js里怎么调用ASP变量呢?

------解决方案--------------------
不要把服务器端脚本和客户端脚本混在一起。
返回到客户端的都是字符串,包括js,所以将asp变量作为字符串拼接到js语句中就可以了

var js_array = new Array();
js_array[0] = " <%=root(0)%> ";
js_array[1] = " <%=root(1)%> ";
...
checkpic(js_array);