IE 7 Problems - javascript

Discussion in 'Scripts' started by objelland, Mar 29, 2008.

  1. #1
    Hi all

    I have a javascript used in a PHP site that causes me some trouble.
    IE does not respond in the expected way.
    What the script is supposed to do is to hide and show text. What happens is that the script redirects to the root of my site.
    Check it out and view the source at http://www.landsnett.no/modules.php?mod=checkout

    The script is activated by clicking on one of the questoin mark images.

    If anyone can see what causes this problem, it is highly appreciated.

    <script language="JavaScript">
    {literal}
    <!--//
    function GetInfo(container)
    {
    var show = document.getElementById('container' + container);
    show.style.display = "block";//show selected info
    var containers = new Array();//initialize array
    {/literal}
    {foreach from=$cat_data item=item}
    containers.push({$item.id});//add each to the end of array
    {/foreach}
    {literal}
    for (var i=0; i<containers.length; i++) { //loop through array and hide all but show
    var idContainer = 'container' +  containers[i];
    if (idContainer != container) {
    document.getElementById(idContainer).style.display = "none";
    }
    }
    }
    //-->
    {/literal}
    </script>
    Code (markup):
    <a id="moreLink" href="#" onClick="GetInfo('container[[id]]');return false;">
    <img src = "templates/meldinn/images/help.png" border="0" alt="Info"></a>
    <div id="container[[id]]" style="display:none">[[description]]<br></div>
    HTML:
    Regards

    Oyvind
     
    objelland, Mar 29, 2008 IP