Show html to browser once button pressed

Hi All

i dont know javascript but do know php and html.


lets say i have some html on a page but i do not wish the browser to see this untill i press a button

how can this be dont please

a formated example would be good

thanks in advance
avo42Asked:
Who is Participating?
 
callrsCommented:
<html>
<!-- HIDE/SHOW & REMOVE/INSERT ELEMENTS - DEMO -->
<!-- By Ravinder Singh, 2006-06-23             -->
<!-- To learn more: http://www.quirksmode.org/js/blockinvi.html
     "IE 6.0 - JavaScript - Display and Visibility"  -->
<!--                                           -->
<head>
<script type="text/javascript">
function HideIt(){
      var obj=document.getElementById("HideMe");
      if(obj.style.visibility=="visible") obj.style.visibility="hidden";
      else obj.style.visibility="visible";
}
function OutIt(){
      var obj=document.getElementById("OutMe");
      if(obj.style.display=="none") obj.style.display="block";
      else obj.style.display="none";
}
</script>
</head>
<P><BR><BR><BR><BR><BR><BR>
<center>
<form>
<input type=button onclick=HideIt() value="Show/Hide me!">
<input type=button onclick=OutIt() value="Insert/Remove!">
</form>
<div id='OutMe' style="display: none">
Make me go away...
</div>
<P>
<div id='HideMe' style="visibility: hidden">
Do you see it now? :)
</div>
</center>
</html>

0
 
ZvonkoSystems architectCommented:
Like this:

<body style="visibility:hidden;" onClick="this.style.visibility='visible';">
<center><h1>Gotcha!</h1></center>
</body>




0
 
ljubiccicaCommented:
Well this didn't work for me but this does...

<html>
<head>
</head>
<body>
<div style="visibility:hidden;" name="asdf" id="asdf">
<center><h1>Gotcha!</h1></center>
<?php
echo "Something with php!";
?>
</div>
<input type="button" value="show html" onClick="asdf.style.visibility='visible';">
</body>
</html>

The idea is to make whole html code inside <div> exept the button...
Hope it helps...

Ljubiccica
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
ljubiccicaCommented:
Sorry callrs, i didn't see your answer...

the Zvonko's answer didin't work for me...

;-)
0
 
ZvonkoSystems architectCommented:
you know that ljubiccica is a beautiful yogoslavian name?
0
 
ljubiccicaCommented:
=)

Are we suppose to talk about it here?

Yes, my mother (from Croatia) called me ljubiccica in front of my friends and so i got one of my nicks...

=)
0
 
Bolter99Commented:
<input type=button onclick="content.style.visibility='';">

<span id=content style="visibility:hidden;">YOUR CODE GOES HERE</span>
0
 
avo42Author Commented:
Thank you to you all for your input

It helps me out lots

All the best
0
 
ZvonkoSystems architectCommented:
It was only because my tested version did not work for you. Anyway. See you.
0
 
callrsCommented:
>>It was only because
Well your example did work...but is cryptic & can confuse, and is missing the button that was asked for. I like dynamic & expanded :-D Helps people learn enough to better understand & get a better start on their own scripts.

That flexibility & functionality can backfire though...one asker saw my MS-DOS code & recoiled without testing it (http://www.experts-exchange.com/Operating_Systems/MSDOS/Q_21884203.html).

Often a matter of time though...the effort takes much more time. But I find it worth while.  : )
0
 
ZvonkoSystems architectCommented:
Let me say it this way: I am since '84 in this business ;-)
0
 
callrsCommented:
Zvonko rules! Yes. I know that from being humbled by you before. But doesn't mean you are perfect.

0
 
ZvonkoSystems architectCommented:
Do you expect that from me :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.