Jump to content

use iamge name (full path) read from database in javascript


vikaspa

Recommended Posts

I am using following scipt for javascript slide show.

 

I want to replace the image names with the one I read using PHP+MYSQL database (conditional SQL statement )

 

Please help help help me to

use image names stored in  PHP variable names

 

Thanks in advance

 

 

<script>

<!--

//configure the paths of the images, plus corresponding target links

slideshowimages("img1.gif", "img2.gif", "img3.gif")

slideshowlinks("http://wsabstract.com", "http://dynamicdrive.com", "http://java-scripts.net")

 

//configure the speed of the slideshow, in miliseconds

var slideshowspeed=2000

var whichlink=0

var whichimage=0

 

function slideit(){

  if (!document.images)

    return

    document.images.slide.src=slideimages[whichimage].src

    whichlink=whichimage

 

  if (whichimage<slideimages.length-1)

    whichimage++

  else

    whichimage=0

    setTimeout("slideit()",slideshowspeed)

}

slideit()

//-->

</script>

Hi..

        yes you can do this via fetching records from db after getting records, you can echo the image name from database in javascript like following:

 

<script>
<!--
//configure the paths of the images, plus corresponding target links
slideshowimages(<?php echo "'$image1'"?>,<?php echo "'$image2'"?>, <?php echo "'$image3'"?>)

 

Is it what you want..?

 

-Vijay

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.