SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
Thread: supressing errors
-
Sep 8, 2003, 04:14 #1
- Join Date
- Jun 2003
- Location
- ether
- Posts
- 4,497
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
supressing errors
Hi
I am not much of a JavaScript programmer. I want to know how can I supress any errors that come in my script, like if there are some errors in my script like syntax errors or runtime errors, the browser(MSIE or NN) display a dialog stating that there are errors in script.
I don't want them to display that.
I know that there's an event
Code:window.onerror = some function
Our lives teach us who we are.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Me - Photo Blog - Personal Blog - Dev Blog
iG:Syntax Hiliter -- Colourize your code in WordPress!!
-
Sep 8, 2003, 08:30 #2
- Join Date
- Dec 2002
- Location
- Alabama, USA
- Posts
- 2,560
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Here's the MS dhtml ref:
To suppress the default Microsoft® Internet Explorer error message for the window event, set the returnValue property of the event object to true or simply return true in Microsoft JScript®.
The onerror event fires for run-time errors, but not for compilation errors. In addition, error dialog boxes raised by script debuggers are not suppressed by returning true. To turn off script debuggers, disable script debugging in Internet Explorer by choosing Internet Options from the Tools menu. Click the Advanced tab and select the appropriate check box(es).Cross-Browser.com, Home of the X Library
-
Sep 8, 2003, 09:12 #3
-
Sep 10, 2003, 08:10 #4
- Join Date
- Jun 2003
- Location
- ether
- Posts
- 4,497
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
To suppress the default Microsoft® Internet Explorer error message for the window event, set the returnValue property of the event object to true or simply return true in Microsoft JScript®.
The onerror event fires for run-time errors, but not for compilation errors. In addition, error dialog boxes raised by script debuggers are not suppressed by returning true. To turn off script debuggers, disable script debugging in Internet Explorer by choosing Internet Options from the Tools menu. Click the Advanced tab and select the appropriate check box(es).
As for returning true for the window.onerror event, I've tried both true & false as well as continue but the dialog still pops open saying that there are some errors in script & would I still like to run it.
So what do I do now??Our lives teach us who we are.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Me - Photo Blog - Personal Blog - Dev Blog
iG:Syntax Hiliter -- Colourize your code in WordPress!!
-
Sep 10, 2003, 10:06 #5
- Join Date
- Jul 2002
- Location
- Dallas, TX
- Posts
- 2,900
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Wait...it gives an error and asks if you'd like to run it? That sounds like you've got a non-terminal loop or something.
Why don't you try to fix your errors first, before masking them?
-
Sep 10, 2003, 10:33 #6
- Join Date
- Jan 2003
- Location
- Calgary, Canada
- Posts
- 2,063
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
the only time i've needed to supress an error was when I had code coming from a remote server for ads that I had no control over.
I guess it could be useful if being viewed in older browsers though.Who walks the stairs without a care
It shoots so high in the sky.
Bounce up and down just like a clown.
Everyone knows its Slinky.
-
Sep 11, 2003, 00:34 #7
- Join Date
- Jun 2003
- Location
- ether
- Posts
- 4,497
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
I went over again & again through the code & I can't figure out where the error is. It was running fine earlier & I hadn't made any changes to the code. The code is here:-
Code:function openWin(w, h, t, l) { var abc = window.open("", "abc", "width="+w+",height="+h+",left="+l+",top="+t+",toolbar=1,scrollbars=1,resizable=1"); }
& I am putting the following in a button to open the window:--
Code:onClick="openWin(350, 200, 100, 100);"
Now this thing was working fine earlier but 2-3 days ago, it started giving errors.
So what could be the problem.
I have to look for some way stop errors from being raised.Our lives teach us who we are.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Me - Photo Blog - Personal Blog - Dev Blog
iG:Syntax Hiliter -- Colourize your code in WordPress!!
Bookmarks