Solved

Show html to browser once button pressed

Posted on 2006-06-22
13
1,087 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:avo42
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 3
  • +2
13 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 16966632
Like this:

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




0
 
LVL 30

Accepted Solution

by:
callrs earned 250 total points
ID: 16966758
<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
 
LVL 7

Assisted Solution

by:ljubiccica
ljubiccica earned 250 total points
ID: 16966778
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:ljubiccica
ID: 16966782
Sorry callrs, i didn't see your answer...

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

;-)
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 16966803
you know that ljubiccica is a beautiful yogoslavian name?
0
 
LVL 7

Expert Comment

by:ljubiccica
ID: 16966883
=)

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
 
LVL 1

Expert Comment

by:Bolter99
ID: 16967177
<input type=button onclick="content.style.visibility='';">

<span id=content style="visibility:hidden;">YOUR CODE GOES HERE</span>
0
 

Author Comment

by:avo42
ID: 16967433
Thank you to you all for your input

It helps me out lots

All the best
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 16967521
It was only because my tested version did not work for you. Anyway. See you.
0
 
LVL 30

Expert Comment

by:callrs
ID: 16967626
>>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
 
LVL 63

Expert Comment

by:Zvonko
ID: 16967760
Let me say it this way: I am since '84 in this business ;-)
0
 
LVL 30

Expert Comment

by:callrs
ID: 16967834
Zvonko rules! Yes. I know that from being humbled by you before. But doesn't mean you are perfect.

0
 
LVL 63

Expert Comment

by:Zvonko
ID: 16967916
Do you expect that from me :)
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Non-Resizable Pharagraph 2 17
Jquery 7 29
Session on Html 8 38
Table header must be on top 2 25
Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question