PDA

View Full Version : Download div content when link is clicked



tombofloyd
05-12-2006, 06:47 PM
Hello all, my first post here, straight away I need some help.
I want to know if this can be done.

I have a page with text etc at the top and a thumbnail gallery below generated with mysql and php which opens a pop up window and larger image once clicked.
I have hidden the thumbnail gallery within a div tag and added a link to show / hide the gallery using a simple script below as 40-50 thumbs are sometimes uploaded. However this of course still downloads the thumbnails as part of the page content when it loads. I want to only download the images when the div is shown by the user when they click the show / hide link, can it be done?.

tombo



<head>
<script>
function showhide(id){
if (document.getElementById){
obj = document.getElementById(id);
if (obj.style.display == "none"){
obj.style.display = "";
} else {
obj.style.display = "none";
}
}
}
</script>

</head>
<body>
<div style="display: none;" id="script">-------------content here-----------
<p><a href="#" onclick="showhide('script'); return(false);">hide again</a></p>
</div>
</body>