比如,我有以下代码用于图片变幻,可是如果我要动态的调用数据库中的图片资料,我数据库中存储的图片为图片网络地址,又该怎么操作呢?
<script id=code language=JavaScript>
var Ga=new Array() <!-- //定义一个变量数组Ga -->
Ga[0]=http://www.****.com/Pic001.JPG; <!-- // 设置要显示的图片地址,有几张就试几个,改变下标0,1,2等等,后面则是上传图片的地址-->
Ga[1]=http://www.**.com/pic002.jpg;
Ga[2]=http://www.***.com/pic003.jpg;
Ga[3]=http://www.****.com/pic004.jpg;
Ga[4]=http://www.****.com/pic005.jpg;
Ga[5]=http://www.***.com/pic006.jpg;
var hayasa=4000 <!-- //两个图片之间延迟时间,4000等于4秒 -->
var suu =1;
var iTransNumber=0;
var garTransitions = new Array(); //arrary of filter strings
garTransitions[0] = "progid:DXImageTransform.Microsoft.RandomDissolve()";
garTransitions[1] = "progid:DXImageTransform.Microsoft.Iris(irisStyle='star', motion='out')";
garTransitions[2] = "progid:DXImageTransform.Microsoft.Iris(irisStyle='diamond', motion='in')";
garTransitions[3] = "progid:DXImageTransform.Microsoft.Iris(irisStyle='cross', motion='out')";
garTransitions[4] = "progid:DXImageTransform.Microsoft.Iris(irisStyle='circle', motion='in')";
garTransitions[5] = "progid:DXImageTransform.Microsoft.Iris(irisStyle='square', motion='out')";
garTransitions[6] = "progid:DXImageTransform.Microsoft.Iris(irisStyle='plus', motion='in')";
garTransitions[7] = "progid:DXImageTransform.Microsoft.Barn(orientation='vertial' motion='in')";
garTransitions[8] = "progid:DXImageTransform.Microsoft.Barn(orientation='vertial' motion='out')";
garTransitions[9] = "progid:DXImageTransform.Microsoft.Barn(orientation='horizontal' motion='in')";
garTransitions[10] = "progid:DXImageTransform.Microsoft.Barn(orientation='horizontal' motion='out')";
garTransitions[11] = "progid:DXImageTransform.Microsoft.Pixelate()";
garTransitions[12] = "progid:DXImageTransform.Microsoft.Inset()";
garTransitions[13] = "progid:DXImageTransform.Microsoft.Checkerboard(Direction='left')";
garTransitions[14] = "progid:DXImageTransform.Microsoft.Checkerboard(Direction='right')";
garTransitions[15] = "progid:DXImageTransform.Microsoft.Checkerboard(Direction='down')";
garTransitions[16] = "progid:DXImageTransform.Microsoft.Checkerboard(Direction='up')";
garTransitions[17] = "progid:DXImageTransform.Microsoft.RandomBars(motion='horizontal')";
garTransitions[18] = "progid:DXImageTransform.Microsoft.RandomBars(motion='vertical')";
garTransitions[19] = "progid:DXImageTransform.Microsoft.Slide(bands=5, slideStyle='push')";
garTransitions[20] = "progid:DXImageTransform.Microsoft.Slide(bands=5, slidestyle='swap')";
garTransitions[21] = "progid:DXImageTransform.Microsoft.Slide(bands=5, slidestyle='hide')";
garTransitions[22] = "progid:DXImageTransform.Microsoft.Spiral()";
garTransitions[23] = "progid:DXImageTransform.Microsoft.Stretch(stretchStyle='push')";
garTransitions[24] = "progid:DXImageTransform.Microsoft.Stretch(stretchStyle='pop')";
garTransitions[25] = "progid:DXImageTransform.Microsoft.Fade(duration=2,overlap=0)";
garTransitions[26] = "progid:DXImageTransform.Microsoft.GradientWipe(duration=2,gradientSize=0.25,motion=forward )";
garTransitions[27] = "progid:DXImageTransform.Microsoft.Wheel(duration=2,spokes=16)";
garTransitions[28] = "progid:DXImageTransform.Microsoft.RadialWipe(duration=2,wipeStyle=CLOCK)";
var kirikaeGa=new Array()
for (kazu=0;kazu<Ga.length;kazu++){
kirikaeGa[kazu]=new Image()
kirikaeGa[kazu].src=Ga[kazu]}
function kirikae(){
if (window.createPopup)
rittai.style.filter = garTransitions[iTransNumber];
iTransNumber++;
if(iTransNumber==garTransitions.length)
iTransNumber=0;
if (window.createPopup)
rittai.filters[0].apply();
document.images.rittai.src=kirikaeGa[suu].src;
if (window.createPopup)
rittai.filters[0].play()
suu++
if (suu==kirikaeGa.length)
suu=0;
setTimeout("kirikae()",hayasa)
}
window.onload=new Function("setTimeout('kirikae()',hayasa)")
</script>
[此贴子已经被作者于2006-7-27 15:41:24编辑过]