Your new condition changes solution quite a bit. So, you need to know which one button is in "clicked" state on general scope and old clicked button must be accessable (so we can turn it off). I think that easiest way would be to create global variable that holds object.id of last clicked button. (but it requires to set unique ids to all of your buttons). Solution would look like:
- <SCRIPT>
-
var last_clicked_element_id = null;
-
-
function makevisible(cur,which){
-
if (which==0)
-
{
-
cur.style.color='black';
-
cur.filters.alpha.opacity=90;
-
}
-
else
-
{
-
if ((!cur.id) || (cur.id != last_clicked_element_id))
-
{
-
cur.style.color='gray';
-
cur.filters.alpha.opacity=40;
-
}
-
}
-
}
-
-
function listinfo(cur)
-
{
-
var old_selected = null;
-
-
if (last_clicked_element_id)
-
{
-
old_selected = document.getElementById(last_clicked_element_id);
-
}
-
last_clicked_element_id = cur.id;
-
if (old_selected) makevisible(old_selected, 1)
-
-
makevisible(cur,0);
-
}</SCRIPT>
-
[HTML]<button style="font-size: 9pt; color: gray; FILTER: alpha(opacity=40); background-color: gainsboro; border: 3px double gainsboro"
onmouseover="makevisible(this,0)"
onmouseout="makevisible(this,1)" onclick="listinfo(this)" id=button1>List1</button>
<br>
<button style="font-size: 9pt; color: gray; FILTER: alpha(opacity=40); background-color: gainsboro; border: 3px double gainsboro"
onmouseover="makevisible(this,0)"
onmouseout="makevisible(this,1)" onclick="listinfo(this)" id=button2>List2</button>[/HTML]
Yes, maybe we can do it better / faster by remembering reference to last clicked object (instead of its id), but this one is easier to understand and you can tune it up yourself.