Results 1 to 5 of 5

Thread: setting display property for div in array

  1. #1
    Join Date
    Nov 2006
    Location
    New York
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default setting display property for div in array

    I am trying to set up page so that one field is not displayed with the page loads. i am pulling the content from a database, so it is in an array. How can I identify the DIV's so that I can manipulate them.

    I can do this with straight HTML and JavaScript, but can't figure it out with the array. because the content is dynamic between pages, I can't specify a head of time how many DIVs there will be in the CSS for each page.

    I hope this makes sense...Thanks

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Well, if everything is dynamic, then it can't be done. There has to be some constant -- the same class, the same id.

    So, what's constant between the pages? What, exactly, are you trying to hide? Does what you're trying to hide change from page to page?

  3. #3
    Join Date
    Nov 2006
    Location
    New York
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    essentially I have a shopping cart, and I want to display the names of the items and the prices in a list form, then have a button to click to see the description. so the descriptions would be display: none; but of course, if I set them all with the same ID then they all pop up when I click to display....I have seen it work on other sites, but I may actually be going about it the wrong way.

  4. #4
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Ok, do this:

    Apply the same class to all of your description divs (it sounds like you have more than one).

    Then use the javascript I helped another poster with here.

    You have to use JavaScript to manipulate the CSS styles.

  5. The Following User Says Thank You to Medyman For This Useful Post:

    rocg23 (06-10-2008)

  6. #5
    Join Date
    Nov 2006
    Location
    New York
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Great, thanks....

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
  •