[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Show html to browser once button pressed

Posted on 2006-06-22
13
Medium Priority
?
1,104 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 1000 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 1000 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

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.
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
Suggested Courses

834 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