old code:
Code: Select all
var image1=new Image()
image1.src="uploads/firstcar.gif"
var image2=new Image()
image2.src="uploads/secondcar.gif"
var image3=new Image()
image3.src="uploads/thirdcar.gif"
var image4=new Image()
image3.src="uploads/cat.gif"Code: Select all
<div class="banner">
<p class="banner_image">
<a href="http://www.w3.org/">
<img src="banner/123.jpg" name="slide" width="290px">
<script>
<!--
//variable that will increment through the images
var step=1
function slideit(){
//if browser does not support the image object, exit.
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
if (step<3)
step++
else
step=1
//call function "slideit()" every 2.5 seconds
setTimeout("slideit()",2500)
}
slideit()
//-->
</script>
</p>
<p class="banner">
<a href="http://www.w3.org/">banner</a>
</p>
</div>New modifications:
Code: Select all
<?php $count_im=1;
$req=mysql_query("select * from banner");
while ($res=mysql_fetch_array($req)){ ?>
var image<?php echo $count_im; ?> =new Image()
image<?php echo $count_im; ?>.src="<?php echo $res["banner"]; ?>"
<?php $count_im++;
}?>