hi, i am interested in using show / hide with javascript
and i came across this:
Code:
<!-- in HEAD of document -->
<script language="javascript">
<!--
var state = 'hidden';
function showhide(layer_ref) {
if (state == 'visible') {
state = 'hidden';
}
else {
state = 'visible';
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.visibility = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].visibility = state;
}
if (document.getElementById && !document.all) {
maxwell_smart = document.getElementById(layer_ref);
maxwell_smart.style.visibility = state;
}
}
//-->
</script>
<!-- CLICK LINK TO SHOW LAYER -->
<a href="javascript://" onclick="showhide('agent99');">click me</a>
<!-- in BODY of document -->
<div id="agent99" style="position:absolute; top:103px; left:153px;
visibility:hidden;">
your stuff to show here
</div>
and it works like how i want it but it leaves a big empty space which is for the content inside the <div>
is there someway to not have the white space
and just simply show the content of the div kinda like these sites
use display = "block" and display = "none" instead of visibility
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
could you be a bit more specific?
do i put this as the style? style="display:block; display:none;"
Not quite.
instead of visibility:hidden use display:none and for visibility:visible use display:block
with visibility:hidden the element will still take up the same space in the document just simply not be seen. By using display:none the element is not shown and will take up no space at all.
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?