Announcement

Collapse
No announcement yet.

Inserting a List of Section Images With JavaScript

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Inserting a List of Section Images With JavaScript

    This code will insert your top-level section images in a list, one underneath the other. When a customer clicks on a section image they will be taken into that section.

    Paste the following code just above the </head> tag in your overall page layout:

    HTML Code:
    <actinic:variable value="All Data From Top Level Sections" name="JavaScriptArray" />
    
    <SCRIPT LANGUAGE = JavaScript>
    <!--
    function ImageList(pItem)
    {
    var strIDs = '';
    {
    for (var i = 1; i <= pItem.length; i++)
    {
    strIDs += '<a href=' + pItem[i].sURL + '><img src="' + pItem[i].sImage + '" alt="'+ pItem[i].sName + '" width=' + pItem[i].nImageWidth + ' height=' + pItem[i].nImageHeight + ' border=0></a><br>';
    }
    }
    return strIDs
    }
    -->
    </SCRIPT>
    And then insert the following code in the main body of the page where you want the image list to appear.

    HTML Code:
    <script language=Javascript1.2>
    document.write(ImageList(sections))
    </script>
    For more information about creating section lists with javascript see this article
Working...
X