"Frank Hoek" <fr*****@planet .nl> writes:
2 buttons next to each other, on a webpage
button 1 makes (onClick) text 1 appear just beneath the button
button 2 makes (onClick) text 2 appear just beneath the button
in each of the texts at the end there's a third button to make the text
dissappear again
IS THIS POSSIBLE?
Yes.
Your caps lock key is stuck :)
HOW?
---
<input type="button" value="Button 1"
onclick="docume nt.getElementBy Id('text1').sty le.visibility=' visible';">
<div id="text1" style="visibili ty:hidden;">
This text is revealed by button 1 and hidden by button 3.
<input type="button" value="Button 3"
onclick="docume nt.getElementBy Id('text1').sty le.visibility = 'hidden';">
</div>
<input type="button" value="Button 2"
onclick="docume nt.getElementBy Id('text2').sty le.visibility=' visible';">
<div id="text2" style="visibili ty:hidden;">
This text is revealed by button 2 and hidden by button 4.
<input type="button" value="Button 3"
onclick="docume nt.getElementBy Id('text2').sty le.visibility = 'hidden';">
</div>
---
I use the CSS property "visibility " to hide and show the texts.
That means that they still take up room on the page, you just can't see
the contents.
You can use "display" instead, setting it to "none" to hide or "block"
to show the text. The advantage of "visibility " is that it works in
more browsers, e.g. Opera 6 (and Netscape 4, but getElementById doesn't
work there).
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'