Solved

Show html to browser once button pressed

Posted on 2006-06-22
13
1,077 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
  • 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
 
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now