Help! My Code Works But Not In Wild Apricot

Last post 01-04-2012, 3:45 PM by Matthew. 2 replies.
Sort Posts:
  •  01-03-2012, 7:35 PM 24543

    • Matthew is not online. Last active: 01-10-2012, 12:05 PM Matthew
    • Top 500 Contributor
    • Joined about 4 months ago
    • Posts 5

    Help! My Code Works But Not In Wild Apricot

    I'm working on my company's website on Wild Apricot and am writing code for a rotating banner. I've tested the code and it works but when I bring it in Wild Apricot, my images won't rotate. Any advice?

     

    <html>
    <body>
    <HEAD>
    <script language="JavaScript1.1">
    var image="";
    var banners=0;
    function cycle() {
      if (++banners > 3) banners=1;
        loadbanners();
        document.banner1.src = image;
        window.setTimeout('cycle();',2000);
      }
    function loadbanners() {
       if (banners==1)
          {image="http://www.pittsburghsocialexchange.com/resources/test/1.jpg";}
       if (banners==2)
          {image="http://www.pittsburghsocialexchange.com/resources/test/2.jpg";}
       if (banners==3)
          {image="http://www.pittsburghsocialexchange.com/resources/test/3.jpg";}
    }
    //-->
    </script>
    <script language="JavaScript1.1">
    <!--
    var link = "http://www.pittsburghsocialexchange.com/Events/Networking"
    function urlswitch() {
    if (banners=1){link = "http://www.pittsburghsocialexchange.com/Events/Lunch";}
    if (banners=2)
    {link = "http://www.pittsburghsocialexchange.com/Events/Wine";}
    if (banners=3)
    {link = "http://www.pittsburghsocialexchange.com/Events/Networking";}
    return link;
    }
    //-->
    </script>
    <HEAD>
    <Body
    onLoad="window.setTimeout('cycle();',2000);(loadbanners());(urlswitch());"
    <Body>
    <Body>
    <a href="http://www.pittsburghsocialexchange.com/Events/Networking" onclick="this.href=urlswitch()">
    <img width="450" height="338" border="0" src="http://www.pittsburghsocialexchange.com/resources/test/1.jpg" name="banner1"></a>
    <BODY>



     

  •  01-04-2012, 11:23 AM 24546 in reply to 24543

    Re: Help! My Code Works But Not In Wild Apricot

    Hello,

     

    There are quite  a few issues with your code - perhaps it may have worked outside of Wild Apricot, but the HTML is invalid so combined with other HTML on the page it won't work.

     

    Also, I would recommend using AJAX or jQuery rather than straight JavaScript - you should find some good scripts on Google by searching "jQuey slideshow"


    Matthieu (Ex-Apricot)
    Please contact support directly for assistance on any of my posts as I will no longer be checking these forums: support@wildapricot.com
  •  01-04-2012, 3:45 PM 24552 in reply to 24546

    • Matthew is not online. Last active: 01-10-2012, 12:05 PM Matthew
    • Top 500 Contributor
    • Joined about 4 months ago
    • Posts 5

    Re: Help! My Code Works But Not In Wild Apricot

    Thanks Matthieu. I'm going to use some jQuery I found called Slidesjs, available at Slidesjs.com. When I download it I get a .zip file with two folders inside (an examples and a source). In the Source folder there are two .js files and the Example folder contains various examples, each with their own css, img, js folders and an index.html file. I can easily edit the images and links in the index.html, but I'm not sure which files I should upload to Wild Apricot and how I can put this on my site. I'd appreciate any help. Sorry for being such novice.
View as RSS news feed in XML
Membership Software - Wild Apricot