从数据库里读取出来,把地址,图片,连接全部都连接起来,放到<input type="hidden" value="读出来的值">
放到这个隐藏里面去,然后用JS读取出来,分割再赋直给URL等
我就是这么干的,没问题的
http://1.ceiea.com:8080/这上面的幻灯片就是动态的,不是做广告哦....

解决方案 »

  1.   

    我照你的写了。字符串处理上出了些问题,暂时就改了图片连接的网址,不能在前台正常显示了。
    提示错误信息Parse error: syntax error, unexpected '[', expecting ',' or ';' in Flash.php on line 10代码如下
    <?php 
    include_once("conn.php");
    $result=mysql_query("select * from flash");
    if(mysql_num_rows($result)>0)
    {
    echo "<form name='frm'>";
    while($rows=mysql_fetch_array($result)>0)
    {
    ?>
    <input type="hidden" name="link<?php echo rows["id"];?>" value="<?php echo rows["link"];?>">//这是第10行,我用link加数据库中id作name值id是1-5,5个数字
    <?php
    }
    echo "</form>";
    }
    else
    {
    echo mysql_error();
    }
    ?>
    <script> String.prototype.replaceAll  = function(s1,s2){    
    return this.replace(new RegExp(s1,"gm"),s2);    
    }
    var ad1=frm.link1.value;
    var ad2=frm.link2.value;
    var ad3=frm.link3.value;
    var ad4=frm.link4.value;
    var ad5=frm.link5.value;
    var imgUrl=new Array();
    var imgLink=new Array();
    var imgTitle=new Array();
    var adNum=0;
    var url ="["+ad1+", "+ad2+", "+ad3+", "+ad4+", "+ad5+"]";//用的是字符串拼接连起来的
    var str="[a.JPG, b.jpg, c.jpg, d.jpg, e.jpg]";
    var in_fo="[, , , , ]";
    url=url.replace("[","");
    url=url.replace("]","");
    str=str.replace("[","");
    str=str.replace("]","");
    in_fo=in_fo.replace("[","");
    in_fo=in_fo.replace("]","");
    links=url.replaceAll(",","|");
    pics=str.replaceAll(",","|");
    texts=in_fo.replaceAll(",","|");   
    var focus_width=666
    var focus_height=266
    var text_height=0
            var swf_height = focus_height+text_height
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
     document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="focus.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">');
     document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
     document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
     document.write('<embed src="pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');  document.write('</object>');
    </script>
    <?php
    mysql_close();
    ?>
      

  2.   

    明显的语法错误:把<input type="hidden" name="link <?php echo rows["id"];?>" value=" <?php echo rows["link"];?>">//这是第10行,我用link加数据库中id作name值id是1-5,5个数字这行改为:<input type="hidden" name="link <?php echo $rows["id"];?>" value=" <?php echo $rows["link"];?>">//这是第10行,我用link加数据库中id作name值id是1-5,5个数字