日期:2014-05-16  浏览次数:20781 次

JS循环数据库
数据库表:WZ
id         pic       link        text
1           A         A1          A2
2           B         B1          B2
3           C         C1          C2
........

下面是图片轮换代码,请问在红色部分‘’中怎么循环数据库里的数据并用“|”符号隔开,如蓝色代码:

var pics='A|B|C';
var links=escape('A1|B1|C1');
var texts='A2|B2|C2';


<script src="/js/sohuflash_1.js" type="text/javascript"></script>
<div id="flashcontent01"></div>
<script type="text/javascript">
var pics='';
var links=escape('');
var texts='';

var speed = 4000;
var sohuFlash2 = new sohuFlash("/Images/focus0414a.swf","flashcontent01","295","275","8","#ffffff");
sohuFlash2.addParam("quality", "medium");
sohuFlash2.addParam("wmode", "opaque");
sohuFlash2.addVariable("speed",speed);
sohuFlash2.addVariable("p",pics);
sohuFlash2.addVariable("l",links);
sohuFlash2.addVariable("icon",texts);
sohuFlash2.write("flashcontent01");
</script>

------解决方案--------------------
encodeURI
encodeURIComponent