Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to purge javascript error

Status
Not open for further replies.

PadamPadam

Programmer
Jul 29, 2007
4
SG
i am seeing javascript error while document.write and want to purge it.

It is showing RadPanelBar is undefined. i tried to purge the error - window.onerror = handleError() and window.onerror = null but nothing works.

even i tried to change status bar message but error image does exist as well as try/catch statement in javascript but it also does not work.

pls let me know how to purge / stop this error.
 
>window.onerror = handleError[highlight]()[/highlight]
[tt]window.onerror = handleError;[/tt]

>and want to purge it.
In the handler, make sure script a return line and return true.
[tt]
function handlerError() { //or with parameters
//etc etc
[blue]return true[/blue]
}[/tt]
 
Err... instead of trying to bury your head in the sand ("The ostrich approach"), why not take steps to find and fix the root cause of the error!

Working around it so you don't see it is just sloppy programming IMHO.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
It is showing RadPanelBar is undefined

pls let me know how to purge / stop this error.


Don't reference RadPanelBar until it is defined??

[monkey][snake] <.
 
I have to use RadPanelBar and it is defined in asp.net and working fine with asp.net. when i use export to excel then i use document.write method of javascript.

it export to excel properly only it throws a error. i want to just purge that error.

nothing does work as sussgested solution in this thread. pls help me out with good solution.
 
Are you calling document.write as the page is loading or after the page is loaded? If after, this will wipe out all the content on the page with what you are writing. Perhaps the reason the error is occurring is because the client-side RadPanelBar code is getting wiped out by the document.write call. In this case, suppressing the error using tsuji's code wouldn't work because the error suppressing code would get wiped out too - unless you wrote the error suppressing code to the window using document.write as well and then called document.close afterward.

But this still doesn't address the underlying issue. What is referencing RadPanelBar in JavaScript and can you prevent it from referencing it after the document.write is used to prevent the error getting thrown in the first place? Is it being called from another frame?

Adam
 
I am using this code in ASP.NET page to export all 3-4 grids data. It is not related to anyhow with excel vba coding.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top