Jump to content

Populating Javascript array from MySQL database OR Adding hyperlinks to slidehow


Calamity-Clare

Recommended Posts

Hi,

I'm going to post this problem identically in both the Javascript forum & the PHP forum, because I have no idea where to get this answer from! There's a couple of different ways I could potentially solve it.

 

I am making a gallery for my portfolio which I have written in Javascript as a slideshow (I've attached all the code so you can see what I mean). By clicking next & back buttons, I am able to change the image, the image number and the image title by calling to javascript arrays.

 

However, I need to turn the image and the image title into a hyperlink which is also dynamic (i.e. it changes for each 'slide'). I believe the way I've written the javascript prevents me from doing this. The image, image title & image number have been assigned a unique id which is used by the javascript to make it dynamic. I can't have the any of the id's encased within another eg:

 

<a href="www.ota.com.au" id="portfolio_url"><img src="portfolio_ota.jpg" id="view_portfolio" alt="" width="450" height="317" border="0" /></a>

This doesn't work and even if it did, the id wouldn't relate to the url, it would change the hyperlink label or, in this case, image, so I can't even solve this problem by adding a separate link on the side.

 

I believe the easiest way to change this would be to populate the hyperlink href, the image, the image title & the image number from a mySQL database. However, the slideshow uses next & back buttons that don't actually refresh the page even though the href's are "next.html" & "previous.html" (don't ask me how, this is magic to me!). I think this means that if I change it to a PHP page instead of an HTML page that part of the code breaks & tries to find a "previous.html" or "next.html" page that doesn't exist.

 

Is there a way around my predicament? I've searched for an answer but I can't find anything that seems to solve the issue that I have.

 

So basically I would like to try & make a slideshow that:

1. adds a hyperlink to the image & image title (or if this isn't possible making a "Click here to view" link on the side)

2. populates the javascript arrays from a mysql database

3. doesn't refresh the current page (I recognise this might not be possible if php is involved, but other web based gallery's don't seem to have this problem, obviously they're set up differently though)

 

Most importantly, I need to add hyperlinks. The other two aims are just my own personal vision for how I want the slideshow to work.

 

I've attached all the code & you can see the slideshow itself at www.clarebyrnedesign.com.au/portfolio.html

 

Thank you!!

 

[attachment deleted by admin]

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.