Results 1 to 5 of 5

Thread: not working ajax content

  1. #1
    Join Date
    May 2006
    Posts
    98
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default not working ajax content

    Switch Content Script II (icon based)

    http://www.dynamicdrive.com/dynamici...chcontent2.htm

    Hi, I have set this script up but i cannot get the ajaxt bit to work.
    I have
    Code:
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title></title>
    <link rel="stylesheet" type="text/css" href="css/new.css">
    
    <script type="text/javascript" src="js/switchcontent.js" ></script>
    <script type="text/javascript" src="js/switchicon.js"></script>
    
    
    </head>
    <h2>Demo 1:</h2>
    <p><a href="javascript:faq.sweepToggle('contract')">Contract All</a> | <a href="javascript:faq.sweepToggle('expand')">Expand All</a></p>
    
    <div class="eg-bar"><span id="faq1-title" class="iconspan"><img src="minus.gif" /></span>What is JavaScript?</div>
    <div id="faq1" class="icongroup1">
    </div>
    <br />
    
    <div class="eg-bar"><span id="faq2-title" class="iconspan"><img src="minus.gif" /></span>Difference between Java & JavaScript?</div>
    <div id="faq2" class="icongroup1">
    </div>
    <br />
    
    
    
    <script type="text/javascript">
    
    var faq=new switchicon("icongroup1", "div") //Limit scanning of switch contents to just "div" elements
    
    faq.setContent(0, 'xx.htm') //specify remote content for 1st header's content
    faq.setContent(1, 'xxx.htm') //specify remote content for 2nd header's content
    
    faq.setHeader('<img src="minus.gif" />', '<img src="plus.gif" />') //set icon HTML
    faq.collapsePrevious(true) //Allow only 1 content open at any time
    faq.setPersist(false) //No persistence enabled
    faq.defaultExpanded(0) //Set 1st content to be expanded by default
    faq.init()
    
    </script>
    but it doesnt seem to work. I have the two js scripts in the head. Do I need to adjust anything for the ajx to work, or do I need another js file? I cannot see a faq.setContent variable in the js files.
    Thanks for any pointers.
    Richard

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

    Default

    Looks right at a glance. Make sure ''xx.htm" and "xxx.htm" exist and are in the same directory as the switch content script.

    If you need more help, please post a link to the page on your site that contains the problematic script so we can check it out.

  3. #3
    Join Date
    May 2006
    Posts
    98
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default

    Hi thanks for the reply, I have the xx.htm and xxx.htm in the same folder as the js files but it doesnt seem to work.
    Here is a test page
    http://www.wotartist.com/ggggg.htm
    Thanks if you spot a problem.
    Richard

  4. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Use this as switchcontent.js as the version you have is not the correct one:

    http://www.dynamicdrive.com/dynamici...itchcontent.js

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

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

    rich1234 (05-21-2008)

  6. #5
    Join Date
    May 2006
    Posts
    98
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default

    Hi, I changed th script and although something works the ajax bit still doesnt. Seems funny, looks like it should work but doesnt.I am testing in ie7.
    Thanks
    richard

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
  •