SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard big_al's Avatar
    Join Date
    May 2000
    Location
    Victoria, Australia
    Posts
    1,661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HELP! Javscript woes, error supression

    Hi,

    I am dynamicaly creating a hierarchial tree that works fine, except two annoying errors that pop up when the pages loads but not while anyone is interacting with the tree.

    Now I thought I could insert some error supression code so the end user does not get annoyed by this but for some @%#@@# reason it won't supress the error.

    here is a link to the page http://test.itsyou.info/TESTS/tree.asp

    The supression scripts I have tried are these (and then some)
    [VBS]
    var errors = new errorObjMaker();
    var count = 0;
    function myError(msg,url,ln)
    {
    errors[count] = msg;
    errors[count += 1] = ln;
    count += 1;
    return true;
    } // end function "myError"
    function errorObjMaker() {}
    function rubItIn()
    {
    var str = "MESSAGE \\ LINE \n\n";
    for (var i = 0; i < count; i++)
    {
    str += errors[i];
    str += (((i+1) % 2) == 0) ? "\n\n" : "\n";
    } // end for "i"
    document.forms[0].disp.value = str;
    } // end function "rubItIn"
    window.onerror = myError; [/VBS]


    [VBS]
    function errorsuppressor(){
    return true
    }
    window.onerror=errorsuppressor[/VBS]

    I hope someone knows whats going wrong here, but I am at a complete loss.

    Thanks In advance
    .NET Code Monkey

  2. #2
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Error supression is NOT your friend!

    If you supporess errors in the HideDisplay function then if you get a genuine error then you'll be supressing it.

    If you WERE to suppress the error - You should use "Try - catch" methods.

    Your ASP is buggy also - and falls over 1 in 3 times.

    Add a conditional control to the function HideDisplay, see if that does it:

    Code:
    function HideDisplay(oItems) {
    	if (oItems.style) oItems.style.display = "none";
            }
    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  3. #3
    SitePoint Wizard big_al's Avatar
    Join Date
    May 2000
    Location
    Victoria, Australia
    Posts
    1,661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Flawless_koder
    Error supression is NOT your friend!

    If you supporess errors in the HideDisplay function then if you get a genuine error then you'll be supressing it.

    If you WERE to suppress the error - You should use "Try - catch" methods.

    Your ASP is buggy also - and falls over 1 in 3 times.

    Add a conditional control to the function HideDisplay, see if that does it:

    Code:
    function HideDisplay(oItems) {
    	if (oItems.style) oItems.style.display = "none";
            }
    Flawless
    Maybe I should have been a little clearer, I just want to surpress it while we track down the problem and fine tune the entire script, just makes things a little quicker.

    As for the ASP error's, not my code my hosts ADO dll's have been corupted somehow and they're looking in to it

    Thanks for the tip I'll give that a go.

    .NET Code Monkey

  4. #4
    SitePoint Wizard big_al's Avatar
    Join Date
    May 2000
    Location
    Victoria, Australia
    Posts
    1,661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unfortunatly putting the condiditional control in the HideDisplay function..

    Any other ideas?

    AL
    .NET Code Monkey


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
  •