473,320 Members | 2,054 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,320 software developers and data experts.

seeing javascript errors

pradeepjain
563 512MB
Hii ..i am a lamp professional!! i use javascript for validation purposes! but sometimes javascript stops working bcos of errors!!and i find it difficult to find those errors! is there any log for javascript errors??
Aug 28 '09 #1
4 1720
RamananKalirajan
608 512MB
Pradeepjain,
Ya, there are two ways of finding errors in your codes. The first way is writing your js code inside a try catch block and the other is to test the codes with the alerts one line after the other. These are the possible two ways through which u can find or debug an error in the js.

Try Catch Block

Expand|Select|Wrap|Line Numbers
  1. try{
  2. // your JS Code...
  3. // your JS Code...
  4. }
  5. catch(e)
  6. {
  7.    alert(e.message);
  8. }

Alerts

Expand|Select|Wrap|Line Numbers
  1. js line no 1
  2. alert("1");
  3. js line no 2
  4. alert("2");
  5. js line no 3
  6. alert("3");
  7. js line no 4
  8. alert("4");
Thanks and Regards
Ramanan Kalirajan
Aug 28 '09 #2
oranoos3000
107 100+
hi
you can using this code for showing your error in separate window and the end of debuging your scripts you can erase this code from the other code
on the input of script tag
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. onerror=showErr;
  3. function showErr(errMsg,location,lineNum)
  4. {
  5. ErrWin=window.open('','new window',"width=100, height=100");
  6. ErrWin.document.write('message of error '+errMsg+'<br />place of error '+location+'number of line that have error'+lineNum);
  7. ErrWin.document.close();
  8. }
  9. </script>
and so if your browser is firefox you can see your error
by clicking menu tools->javascript consol
be success
Sep 1 '09 #3
gits
5,390 Expert Mod 4TB
another excellent extension for Firefox is Firebug ... have a look here ... i cannot live without it :) ... you could debug, inspect, test nearly everything of a webpage with it ...

kind regards
Sep 1 '09 #4
I have just released code to help log JavaScript errors by sending error information to the server. If you want to use ASP.Net, you can take a look at the control here -
http://www.thecodepage.com/post/Java...fications.aspx
Feb 2 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.