green
06-28-2007, 06:07 AM
I've been using this script for toggling elements on and off.
<script type="text/javascript">
<!--
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'none')
e.style.display = 'block';
else
e.style.display = 'none';
}
//-->
</script>
BUT, I have TWO elements; 1 visible and 1 invisible and I'd like the following:
onClick from one single link eg.<a href>: element 1 becomes visible and element 2 becomes INvisible at the same time. onClick again element 2 becomes visible and element 1 becomes INvisible etc. ie. only one element visible at any one time.
Any ideas greatly appreciated.:cool:
<script type="text/javascript">
<!--
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'none')
e.style.display = 'block';
else
e.style.display = 'none';
}
//-->
</script>
BUT, I have TWO elements; 1 visible and 1 invisible and I'd like the following:
onClick from one single link eg.<a href>: element 1 becomes visible and element 2 becomes INvisible at the same time. onClick again element 2 becomes visible and element 1 becomes INvisible etc. ie. only one element visible at any one time.
Any ideas greatly appreciated.:cool: