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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.