Connecting Tech Pros Worldwide Forums | Help | Site Map

Hidden text.

opt_inf_env@yahoo.com
Guest
 
Posts: n/a
#1: Jul 24 '05
Hello,

is there any possibility to make the following with html. On my page I
want to put "link" after clicking on which several lines of text
appears after this link, then if one click on this link again the
menitioned text disappears. Another content of the page should not
change.


Lachlan Hunt
Guest
 
Posts: n/a
#2: Jul 24 '05

re: Hidden text.


opt_inf_env@yahoo.com wrote:[color=blue]
> is there any possibility to make the following with html. On my page I
> want to put "link" after clicking on which several lines of text
> appears after this link, then if one click on this link again the
> menitioned text disappears. Another content of the page should not
> change.[/color]

Not with HTML alone. Ask in a javascript related group.

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
RobG
Guest
 
Posts: n/a
#3: Jul 24 '05

re: Hidden text.


opt_inf_env@yahoo.com wrote:[color=blue]
> Hello,
>
> is there any possibility to make the following with html. On my page I
> want to put "link" after clicking on which several lines of text
> appears after this link, then if one click on this link again the
> menitioned text disappears. Another content of the page should not
> change.
>[/color]

As Lachlan said, this requires CSS and JavaScript, HTML is just there
for show (literally).

The following script toggles an element's display property between ''
and 'none'. You may want to modify the visibility attribute instead
(toggle between 'visible' and 'hidden'. It is intended as a
demonstration only, and will not work in browsers that don't support
getElementById or element style object (older versions of IE and
Netscape, put a few others).

Use with caution, do not make your page dependent on JavaScript, it
should only be used to add a few bells and whistles. Your page
should be fully functional without it.



<style type="text/css">
.fauxLink {text-decoration: underline; color: blue;
cursor: pointer; font-weight: bold;}
</style>
<script type="text/javascript">
function showHide(ele){
var x;
if ( document.getElementById
&& (x = document.getElementById(ele))
&& x.style )
{
x.style.display = ('none' == x.style.display)? '' : 'none' ;
}
}
</script>
<span class="fauxLink" onclick="
showHide('tgt');
">Click me</span><span id="tgt">&nbsp;I am some text</span>



--
Rob
Closed Thread