Results 1 to 4 of 4

Thread: How to write javascript to Display Block

  1. #1
    Join Date
    Nov 2008
    Posts
    77

    How to write javascript to Display Block

    I usually stay away from dynamically hiding and showing layers, When the user clicks on the div containing the word "Menu", the lower div (id = dropper) displays as a block (which is fine). I am trying to make a link or div that you can click and have another div appear under it. Ideally i want it to use the css display. However, when the user clicks on the "Menu" div again, the dropper div does not revert back to display:none. Any thoughts?

  2. #2
    Join Date
    Nov 2008
    Posts
    86

    Re: How to write javascript to Display Block

    In each of your "onclick" events that call that function, all you need to do is include the id of the div you want to show when you call the function. 'display' property of CSS decides how an element would be displayed. Since you already have a table, it doesn't make sense to set the display property to table. IE doesn't use or respect the proper CSS display values for tables, rows etc. You simply use "block". Very convenient, but it doesn't work well in well-behaved browsers.

  3. #3
    Join Date
    Nov 2008
    Posts
    102

    Re: How to write javascript to Display Block

    The javascript dom model for setting css properties is quite outdated (just like functions Dreamweaver injects in your code for swapping images). I have tried out the setting of display property but it has blocked me. Mysteriously enough, it didn't work neither in IE nor in any other browser! therefor i use the visibility property. There are three selections: visible, hidden, and collapse. Visibility is also a recognized style method. You may try this for your problem.

  4. #4
    Join Date
    Oct 2008
    Posts
    134

    Re: How to write javascript to Display Block

    When the script replaces the IMG with the SPAN it transfers the width and height properties of the IMG to the CSS width and height properties of the SPAN's style attribute. You need to take the block out of #logo the image image blg_title_images shows up but blg_logo has a 3px space under it. If I leave block in the space goes away and so does blg_title_images. Try out the following display block in your program.
    Code:
    p.inline
    {
    display:inline;
    }

Similar Threads

  1. How to stop insecure JavaScript block in chrome
    By hanni ball in forum Technology & Internet
    Replies: 3
    Last Post: 25-02-2012, 12:01 PM
  2. Javascript write to file
    By Din_the1 in forum Software Development
    Replies: 4
    Last Post: 29-05-2010, 12:38 PM
  3. Replies: 3
    Last Post: 22-09-2009, 09:38 AM
  4. How to write javascript isobject
    By Zombi in forum Software Development
    Replies: 3
    Last Post: 28-07-2009, 11:54 AM
  5. How to write Cookies in Javascript
    By Janet J in forum Windows Software
    Replies: 3
    Last Post: 30-01-2009, 11:50 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,630,321.57355 seconds with 17 queries