Results 1 to 3 of 3

Thread: Dynamic Ajax Content Script: How to close all div's but current

  1. #1
    Join Date
    Jun 2006
    Location
    DC
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Dynamic Ajax Content Script: How to close all div's but current

    Script: Dynamic Ajax Content: http://www.dynamicdrive.com/dynamici...jaxcontent.htm

    Usage: I am using the Dynamic Ajax Content Script to show answers to a list of FAQs. For example,

    h2><a href="javascript:ajxCall('faqs/busloan.html','faq1');">How can I apply for a business loan?</a></h2>
    <div id="faq1"></div>

    <h2><a href="javascript:ajxCall('faqs/creditcards.html','faq2');">Do you offer credit card processing services?</a></h2>
    <div id="faq2"></div>
    ....


    Problem/Question: Seeing that the dynamic content is not loaded in the same place, the new content does not replace the previous, thereby leaving multiple answers open without a way to close them. Is there as simple way to close all other divs when you click on a new one? Would appreciate any help...thanks!
    Last edited by ddadmin; 06-09-2006 at 05:51 AM.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Firstly, note that I've removed the link to ecodebank.com, as I don't recall granting them permission to copy our scripts onto their own site.

    Regarding your question, the easiest way is actually to just specify the same DIV (ie: faq1) as the DIV to load the ajax content into in each case. So the 2nd link would look like:

    Code:
    <h2><a href="javascript:ajxCall('faqs/creditcards.html','faq1');">Do you offer credit card processing services?</a></h2>
    <div id="faq2"></div>

  3. #3
    Join Date
    Jun 2006
    Location
    DC
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi thanks for your reply. Yes, I think I understand what you mean and why it would work. But, I really don't know much about scripting. I tried to research passing and setting variables and figure you do this with an onclick that calls a function but I just wasn't able to get any part of it working...I am just too much of a scripting newbie. Would you be willing to show me exactly what I need to do to implement? Thanks so much! Janet

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
  •