Problem swapping image in IE with relative url

Discussion in 'Javascript' started by Hubbers, Jun 1, 2006.

  1. Hubbers

    Hubbers Guest

    I have this function for deselecting a groupd of links and images and
    highlighting another. Basically I want to make all the lines to be
    grey (#999) except the one that is clicked which should be red (#c03)
    at the same time a folder image is opened or closed depending which
    line is clicked. It works fine in FireFox but not in IE6.

    function doFolder(x) {
    // alert(x);
    for (n=1;n<4;n++) {
    document.getElementById('img' + n).src = 'img/IconCloseFolder.gif';
    document.getElementById('link' + n).style.color = '#999';
    }
    document.getElementById('img' + x).src = 'img/IconOpenFolder.gif';
    document.getElementById('link' + x).style.color = '#c03';
    }

    It works on these three lines of code:

    <p><span><img src="img/IconCloseFolder.gif" id="img1" height="12"
    width="19" alt="" title="" /><a href="javascript:void(0);" id="link1"
    onclick="javascript:doFolder('1');">My Saved Searches</a></span><img
    src="img/IconEdit.gif" height="15" width="15" alt="Edit" title=""
    /><img src="img/IconDelete.gif" height="15" width="15" alt="Delete"
    title="" /></p>

    <p><span><img src="img/IconCloseFolder.gif" id="img2" height="12"
    width="19" alt="" title="" /><a href="javascript:void(0);" id="link2"
    onclick="javascript:doFolder('2');">Orion Project</a></span><img
    src="img/IconEdit.gif" height="15" width="15" alt="Edit" title=""
    /><img src="img/IconDelete.gif" height="15" width="15" alt="Delete"
    title="" /></p>

    <p><span><img src="img/IconCloseFolder.gif" id="img3" height="12"
    width="19" alt="" title="" /><a href="javascript:void(0);" id="link3"
    onclick="javascript:doFolder('3');">Bob's Searches</a></span><img
    src="img/IconEdit.gif" height="15" width="15" alt="Edit" title=""
    /><img src="img/IconDelete.gif" height="15" width="15" alt="Delete"
    title="" /></p>
     
    Hubbers, Jun 1, 2006
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.