Solved

Show html to browser once button pressed

Posted on 2006-06-22
13
1,082 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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Capture logon name 13 73
Trying to redirect after event in javascript 3 24
How to make a moving character 3 59
Get Pixel color of the x and y axis Html without canvas 8 38
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

803 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