PHP/MySQL - Load More Data on Click

Hi,

i have a table in my db that contains text and 5 images. on the page load i only want the text and one image to be displayed. then when the image is clicked on the remaining four images are displayed with the original content. i have pulled the  text and image. I dont know how to go about loading the rest of the images on click.

Any advice would be helpful.
davidcairns90Asked:
Who is Participating?
 
xBelloxCommented:
It would be something like this:

<html><head>
<script type="text/javascript">
function showOthers() {
	var myDiv = document.getElementById('others');
	myDiv.style.visibility = 'visible';
	myDiv.style.display = 'block';

};
</script>
</head>
<body>
<div id="first">
My 1st text and image... <img src='teste.gif' onClick='showOthers()'>
</div>
<div id="others" style="visibility: hidden; display: none;">
My 2nd text and image... <img src='test2.gif'><br><br>
My 3rd text and image... <img src='test2.gif'><br><br>
My 4th text and image... <img src='test2.gif'><br><br>
My 5th text and image... <img src='test2.gif'><br><br>
</div>
</body></html>

Open in new window

0
 
xBelloxCommented:
I think if it's only 5 images, that the best way to do this is using javascript and css.

You hide the others 4 text and images and at the event onClick of your 1st image you show the rest.
0
 
davidcairns90Author Commented:
xBellox

i have very limited knowledge of javascript. is it possible to elaborate on this
0
 
davidcairns90Author Commented:
Thank you. worked like a dream
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.