Connecting Tech Pros Worldwide Help | Site Map

Why don't onerror function alert's popup?

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 09:13 AM
Robert Oschler
Guest
 
Posts: n/a
Default Why don't onerror function alert's popup?

If I set window.onerror to an error handler I've created, I don't see the
browser error dialogs anymore but I don't see the alert() messages in my
error handler pop up either. Can someone tell me what I am doing wrong?
Here's the test doc I'm using:

=========== BEGIN TEST DOC ===================

<HTML>
<TITLE> OnError Test </TITLE>
<HEAD>

<script>
window.onerror=x;

function x(a, b, c)
{
alert("hello");
alert(a + b + c);
return true;
}
</script>

</HEAD>
<BODY>
<script>
bbb(); // Function doesn't exist so it triggers error.
</script>
</BODY>
</HTML>

========== END TEST DOC ==========

--

Robert Oschler
"Let the web hear you, add your voice to your web site in minutes!"
-- http://audiodirect.spiderchase.com/
(For a limited time, free voiceover with every sign-up, use this link
instead)
-- http://audio.spiderchase.com/
(A song - are you blue?)
-- http://bluedreams.spiderchase.com/



  #2  
Old July 20th, 2005, 09:13 AM
ManoDestra
Guest
 
Posts: n/a
Default Re: Why don't onerror function alert's popup?

Your code worked fine in my browser. I can't see anything wrong with what
you've written. It is correct to say "window.onerror = x" not
"window.onerror = x(1, 2, 3)" as you are merely registering the function
that will handle the error, it will take the three parameters that are
normally passed to the standard onerror anyway. If you are not seeing the
correct info or alerts, I would suggest that it is a browser problem.

I tried to do something similar at work recently on IE5 and it didn't work,
even though window.onerror is part of JavaScript 1.2. Didn't work at all.
Tried it at home and IE6 and it works beautifully. If you're running IE6,
then I have no idea why this is not working for you.

Peter.

"Robert Oschler" <no_replies@fake_email_address.invalid> wrote in message
news:WynSa.605$gi.763359@news2.news.adelphia.net.. .[color=blue]
> If I set window.onerror to an error handler I've created, I don't see the
> browser error dialogs anymore but I don't see the alert() messages in my
> error handler pop up either. Can someone tell me what I am doing wrong?
> Here's the test doc I'm using:
>
> =========== BEGIN TEST DOC ===================
>
> <HTML>
> <TITLE> OnError Test </TITLE>
> <HEAD>
>
> <script>
> window.onerror=x;
>
> function x(a, b, c)
> {
> alert("hello");
> alert(a + b + c);
> return true;
> }
> </script>
>
> </HEAD>
> <BODY>
> <script>
> bbb(); // Function doesn't exist so it triggers error.
> </script>
> </BODY>
> </HTML>
>
> ========== END TEST DOC ==========
>
> --
>
> Robert Oschler
> "Let the web hear you, add your voice to your web site in minutes!"
> -- http://audiodirect.spiderchase.com/
> (For a limited time, free voiceover with every sign-up, use this link
> instead)
> -- http://audio.spiderchase.com/
> (A song - are you blue?)
> -- http://bluedreams.spiderchase.com/
>
>[/color]


  #3  
Old July 20th, 2005, 09:13 AM
Janwillem Borleffs
Guest
 
Posts: n/a
Default Re: Why don't onerror function alert's popup?


"Robert Oschler" <no_replies@fake_email_address.invalid> schreef in bericht
news:WynSa.605$gi.763359@news2.news.adelphia.net.. .[color=blue]
> If I set window.onerror to an error handler I've created, I don't see the
> browser error dialogs anymore but I don't see the alert() messages in my
> error handler pop up either. Can someone tell me what I am doing wrong?
> Here's the test doc I'm using:[/color]
.....[color=blue]
> window.onerror=x;
>[/color]

window.onerror = function () {
x('a', 'b', 'c');
}

JW


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.