PDA

View Full Version : help with open and close div



emanuelle
02-13-2011, 01:22 PM
I would like the "i" icon to open and close the div(it is located on the right side under the title of the project)

right now it only opens and the buttons "x" closes it

Any suggestions?

http://www.alexis-html.com/ram/public_art_amnestree.html

vwphillips
02-13-2011, 01:51 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<script type="text/javascript">
function show(element) {
var el = document.getElementById(element);
el.style.display = "block";
}
function closeContent(element,element1) {
var el = document.getElementById(element);
el.style.display = "none";
}
function toggle(element,imgID,img1,img2) {
var el = document.getElementById(element);
el.style.display = el.style.display=="block"?'none':'block';
document.getElementById(imgID).src=el.style.display=="block"?img2:img1;
}
</script>
</head>

<body>

<div class="pubwrap_inner_title_icon"> <a href="#" onClick="toggle('myDivBlock','tst','http://www.alexis-html.com/ram/images/icon_info.gif','http://www.alexis-html.com/ram/images/i_close.gif')"><img id="tst" src="http://www.alexis-html.com/ram/images/icon_info.gif" alt="Project Data" title="Project Data" border="0"/></a></div>

<div id="myDivBlock" style="display:none;" class="div_watch"><a href="Javascript:closeContent('myDivBlock')" ><img src="http://www.alexis-html.com/ram/images/i_close.gif" alt="Close" title="Close" border="0"/></a><br /><br />
<strong>Amnestree, 2004</strong><br />
Maarssen, The Netherlands<br /><br />
A monument for the Declaration of Human Rights<br />
Polished stainless steel, Maple tree, 300 x 266 x 266 cm <br />

Commissioned by Amnesty International and CBK Utrecht<br />
Photos by Allard Bovenberg and RK<br />



</body>

</html>