Results 1 to 6 of 6

Thread: Javascript error help

  1. #1
    Join Date
    Sep 2006
    Posts
    20
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Javascript error help

    I am using some javascript code that jscheuer1 (sp?) posted a couple months ago. This is the part where I am getting an error:

    PHP Code:
    function compose(){
    var 
    addys=''cc='?cc='boxes document.getElementById('boxes').getElementsByTagName('input')
    for (var 
    i=0i<boxes.lengthi++)
    if (
    boxes[i].checked&&boxes[i].name=='mail')
    addys+=boxes[i].value+', ';
    else if (
    boxes[i].checked&&boxes[i].name=='cc')
    cc+=boxes[i].value+', ';
    addys=addys.replace(/, $/, '');
    cc=cc!='?cc='cc.replace(/, $/, '') : '';
    var 
    mailwin=window.open('mailto:'+addys+cc);
    mailwin.close();

    I also added some database selection criteria. If I make a selection from the database, I get an error, but it works anyway and pops up the compose box. The error says:
    Line: 92
    Char: 1
    Error: "null" is null or not an object
    Code: 0

    If I try to pull everything from the database and not filter it, then I get an error and it won't bring up the compose box. The error now says:
    Line: 91
    Char: 1
    Error: Invalid syntax
    Code: 0

    I show that Line 91 is var mailwin=window.open('mailto:'+addys+cc);

    Any idea what the problem is here? Thanks

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Javascript errors of that sort often refer to the line number before the one reported.

    What browser gives these errors and what email client are you using?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Sep 2006
    Posts
    20
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I am actually able to see the error in IE6.0, but it does the same thing in Firefox, but it just doesn't work, it doesn't give me the error message. Email client is Outlook Express at work, and I just tried here at home with Thunderbird with the same results.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    In FF the error is reported but, unless you have the developer's extension, you need to open up the javascript console to see any evidence of it:

    Tools > JavaScript Console

    You will often, but not always, get a more precise and accurate error report from FF. Give that a shot as, since I have no idea what is involved with:

    added some database selection criteria
    Unless you post a link to the page, there is little I can do to help diagnose this. You or I might get a clue from the FF javascript console error(s) but, what we probably really need to see is the source and/or the generated source.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Sep 2006
    Posts
    20
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Here is what I got from the FF error console:

    Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMXULElement.boxObject]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://global/content/bindings/tabbrowser.xml :: _notifyBackgroundTab :: line 2867" data: no]
    But I get that same thing whether it works or not.

    I will PM you the URL info.

  6. #6
    Join Date
    Sep 2006
    Posts
    20
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Hmm, I am playing with it, and I notice that if I uncheck all and try to send to just one person, or a selection of people, it is working. And that's just the difference in the check box, it wouldn't be a change in the code, so I think the page is probably ok, but maybe it is hitting a limitation or something? I unchecked until it worked, and I think I counted around 80 emails. But then if I turn more on, it doesn't work again.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •