473,382 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

suppress script errors

window.onerror is used to catch and supress the script error. but it
will catch the error only when the script is within the same source
file.

for example, consider a html file MainFrame.htm as,

<IFRAME src="ScriptError.jsp" id="controllerFrame"
name="controllerFrame" height=150 width="450"
APPLICATION="yes"></IFRAME>
<BR>
<DIV id=oErrorLog style="border:1px groove orange
;width:450px;height:200px; "></DIv>
<SCRIPT>
var frm=document.frames;
window.onerror=fnErrorTrap;
oErrorLog.innerHTML=frm(1).name;
function fnErrorTrap(sMsg,sUrl,sLine){
alert("err");
oErrorLog.innerHTML="<b>An error was thrown and caught. </b><p>";
oErrorLog.innerHTML+="Error: " + sMsg + "<br>";
oErrorLog.innerHTML+="Line: " + sLine + "<br>";
oErrorLog.innerHTML+="URL: " + sUrl + "<br>";
return true;
}
</SCRIPT>

ScriptError.jsp is as:

<BODY>
<INPUT TYPE="text" ID=oErrorCode VALUE="someObject.someProperty=true;">
<script>
document.write(eval(oErrorCode.value));
</script>
</BODY>

in the script of MainFrame.htm, frm(1) is null object and the error is
catched and suppressed, but the file scriptError.jsp also has the
script errror. what i need is to catch the error in scriptError.jsp
also from the MainFrame.htm, is it possible to catch the error?

Jul 23 '05 #1
1 2700
Ivo
"suganya" wrote
window.onerror is used to catch and supress the script error. but it
will catch the error only when the script is within the same source
file. <snip> window.onerror=fnErrorTrap;


You could add a line like this:

window.frames[yourframename].onerror=fnErrorTrap;

before or after the content of the frame has been written, you 'll need to
experiment with that..
Or add a error trapping function in your document.write statement.
hth
--
Ivo

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: lawrence | last post by:
This line: if (file_exists($fileName)) { is (on some web servers) giving me this kind of error: Warning: SAFE MODE Restriction in effect. The script whose uid is 1022 is not allowed to...
6
by: Krishna Srinivasan | last post by:
I have a form with check boxes. When accessing a check box element that is not checked, I get a notice (Notice: Undefined variable..). Is there a way to hide these notices and warning in PHP code...
1
by: Uttam | last post by:
Hello, How does one suppress the "Object already exists" message when the following statement is executed in ADO? cat.Views.Append "Some_Query", cmd Thanks in advance. Uttam
4
by: teddysnips | last post by:
I posted yesterday about a project I'm involved in to build a login application using a barcode scanner. I've solved most of the problems, but one remains. The client want to disable keyboard...
1
by: Ron St-Pierre | last post by:
Whenever I run certain functions, such as the example below, the output is either displayed in the terminal or emailed to be by cron, depending on how I run it. Is there any way I can re-write the...
6
by: Ron St-Pierre | last post by:
Is there a way 'within' psql to suppress output? One of our cron scripts calls a sql file which contains various database commands (ALTER TABLEs, UPDATEs, etc) and various user-defined functions....
2
by: ZeeHseez | last post by:
Hi, I have written a webbrowser application in VB .net Framework 1.1. I would like to suppress javascript error messages. However, the silent property of the webbrowser control suppresses the...
0
by: Evert | last post by:
Hi all! I have a script that queries a whole bunch of clients for a specific value. Some of the clients do not repond properly, and then I end up with lines like: Warning: snmpget(): Error in...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.