Announcement

Collapse
No announcement yet.

Section Images with JavaScript

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

    Section Images with JavaScript

    Hi there

    has anyone got the "Inserting a List of section images with JavaScript" part of the Advanced User Guide to work.

    Whenever I put the code on a clean page and preview I get a javascript error ("object expected" I believe)

    Here's the code as copied from the AUG. For a start should the language = javascript have quotations around javascript? I've also searched for pItem in the actiniccore.js and actinicextras.js and there seems to be no reference which may be throwing up the object expected error.

    <!--@act NETQUOTEVAR:TOPLEVELSECTIONS_RAW -->
    <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>


    Anyway, any ideas anyone?

    Thanks in advance, Garry

    #2
    I just tried this and it worked fine.

    Make sure you post the follwing code:
    Code:
    <!--@act NETQUOTEVAR:TOPLEVELSECTIONS_RAW -->
    <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>
    underneath the two lines that reference actiniccore.js and actinicextras.js.

    I did remove the linebreaks from the great big long line above - see if that affects anything.

    Also make sure you have these lines:
    Code:
    <script language=Javascript1.2>
    	document.write(ImageList(sections)) 
    </script>
    within the main body of the page somewhere.

    Comment

    Working...
    X