Jump to content

expand and hide images


php_begins

Recommended Posts

i need to be able to expand and hide images too when i click on a button..

 

<script type="text/javascript">

function toggleMe(a){
  var e=document.getElementById(a);
  if(!e)return true;
  if(e.style.display=="none"){
    e.style.display="block"
  } else {
    e.style.display="none"
  }
  return true;
}
</script>

<input type="button" class="button" onclick="return toggleMe('para1')" value="Show all Banners">
<div id="para1" style="display:none">
     <?
        $allbanners=mysql_query("SELECT * from ads where active='Y' )           or die(mysql_error());
while($allbanners_results = mysql_fetch_assoc($allbanners))
{

   $banner_image_path = $allbanners_results['image_path'];  
		                
   $banner_url = $allbanners_results['URL']; 

   $banner_title = $allbanners_results['title'];
   echo "<tr><td width='468' align='left'><a href='".$banner_url."'><B><font size='3' face='arial'>".$banner_title."</font></B><img border=0 src='./images/" . $banner_image_path . "'></a></td></tr>";
  echo "testing"

}
     ?>
  </div>

 

The above code works only for text expansion.

i want to expand and hide images upon click 'Show All Banners'

Link to comment
https://forums.phpfreaks.com/topic/252519-expand-and-hide-images/
Share on other sites

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.