Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 16th, 2003, 02:43 AM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Mimi
Default difference between style.visibility and style.disp

:DHallo!!!

I was instructed to use style.display instead of style.visibility, what's the difference? I noticed that style.visibility was used to hide fields, can that be done with style.display? If yes, how?

Thanks!!!

  #2 (permalink)  
Old September 16th, 2003, 06:21 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

style.visiblity makes the element visible or hidden, it is still rendered and takes up space on the page even if you can't see it. If you set style.display to "none" the markup is not processed and does not take up space on the page.

--

Joe
  #3 (permalink)  
Old September 17th, 2003, 04:45 AM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Mimi
Default

Thanks Joe!

 I dunno what's wrong with my code! When I used style.display instead of style.visibility the hidden parts don't show! What could be the problem???
Help please! Thanks

  #4 (permalink)  
Old September 17th, 2003, 04:50 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Why should the hidden parts show? What is your exact code? If you set visibility to "hidden" then setting the style.display to "block" will not unhide the element.

--

Joe
  #5 (permalink)  
Old September 17th, 2003, 06:02 AM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Mimi
Default

This was my original code:
if (f.Over.checked == true) {
        Over.style.visibility = 'visible';

This is my new code
if (f.Over.checked == true) {
        Over.style.display = "block";


Whats wrong with my new code?
If you want to see my whole code just tell me.

Thanks Joe!

  #6 (permalink)  
Old September 17th, 2003, 07:23 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Not sure what you wish to do. If Over is a checkbox and is checked then do you want to set it to dispaly? If so then:
Code:
Over.style.display = "inline";
or
Code:
Over.style.display = "";
should be okay. It seems a bit odd though, if the box was set to display:none then how could it be checked?

--

Joe
  #7 (permalink)  
Old September 17th, 2003, 11:50 PM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Mimi
Default

hey thanks Joe! Used Over.style.display = "";
 and it worked :)

Super thanks!



Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView Style.! vinod ASP.NET 2.0 Professional 1 January 21st, 2008 06:05 AM
Style wiegel BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 February 27th, 2007 09:28 PM
Help with Style Builder jasonntp ASP.NET 2.0 Basics 1 November 11th, 2006 01:35 AM
Help with style Boomah XSLT 4 November 2nd, 2006 09:19 AM
non-selectable style? nerssi CSS Cascading Style Sheets 1 June 23rd, 2005 09:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.