1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

javascript Error

Discussion in 'JavaScript' started by Felito, Sep 11, 2010.

  1. #1
    Hy guys

    i have this error

    uncaught exception: [Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://www.tgi.com.pt/merdo/scroll/ :: anonymous :: line 435" data: no]

    the problem is this code

    
    <script type="text/javascript">
    var gal = {
    init : function() {
    if (!document.getElementById || !document.createElement || !document.appendChild) return false;
    if (document.getElementById('gallery')) document.getElementById('gallery').id = 'jgal';
    var li = document.getElementById('jgal').getElementsByTagNa me('li');
    li[0].className = 'active';
    for (i=0; i<li.length; i++) {
    li[i].style.backgroundImage = 'url(' + li[i].getElementsByTagName('img')[0].src + ')';
    li[i].style.backgroundRepeat = 'no-repeat';
    li[i].title = li[i].getElementsByTagName('img')[0].alt;
    gal.addEvent(li[i],function() {
    var im = document.getElementById('jgal').getElementsByTagNa me('li');
    for (j=0; j<im.length; j++) {
    im[j].className = '';
    }
    this.className = 'active';
    });
    }
    },
    addEvent : function(obj, type, fn) {
    if (obj.addEventListener) {
    obj.addEventListener(type, fn, false);
    }
    else if (obj.attachEvent) {
    obj["e"+type+fn] = fn;
    obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
    obj.attachEvent("on"+type, obj[type+fn]);
    }
    }
    }
    
    gal.addEvent(window,'load', function() {
    gal.init();
    });
    </script>
    
    Code (markup):
    I thin this is a conflict between fancybox plug in and the script above

    http://www.tgi.com.pt/merdo/scroll/

    I really need help...

    Thanks
     
    Felito, Sep 11, 2010 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Not sure if this is related to the problem, but I found two instances of .getElementsByTagNa me('li');
    That ain't right ;)
     
    Cash Nebula, Sep 13, 2010 IP
  3. Felito

    Felito Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    However I can solved the problem with another script. By the way i have a new problem. Now i have two pages, separately, and work without problems, but i need these two pages in one file. But my idea is to have a index page with buttons that import (load content) these two pages. I think the problem is a conflict between fancybox...because the files are functioning without problems in separately. there is some different way to do this without ajax? What is your suggestion?

    w w w.tgi.com.pt/merdo/scroll/indexaa.html
    w w w.tgi.com.pt/merdo/scroll/indexa.html
    w w w.tgi.com.pt/merdo/scroll/index.php
     
    Last edited: Sep 13, 2010
    Felito, Sep 13, 2010 IP