Analysing Error Using alart - preCharge Forums
It shows that you are unregistered. Please register with us by clicking Here
preCharge Forums


Nav Green LeftNav Right
preCharge Forums > Website Design & Development > Programming > JavaScript » Analysing Error Using alart


Reply
Tcat Right
 
LinkBack Thread Tools Display Modes Tcat Right
Old 07-19-2006   #1 (permalink)
Nazir
Member
 
Join Date: Jul 2006
Age: 48
Posts: 45
Default Analysing Error Using alart

The alart function is a very useful means of analyzing errors. You can use it at any point in a script to probe objects and variables to see if they contain the data you expect. For example, if you have a function that has several conditional branches, you can add an alert within each condition to find out which is being executed:

function checkAge(years)
{
if (years < 13)
{
alert ('less then 13');
ther scripting
}
else if (years >= 13 && years <= 21)
{
alert ('13 to 21');
ther scripting
}
else
{
alert ('older');
ther scripting
}
}

Maybe the value for years is not coming back as a number, like it should. You could add to the start of your script an alert that tests the variable to see what type it is:

function checkAge(years)
{
alert(typeof years);
:
:
}

In theory, you can put any amount of information in an alert dialog, although a very long string of data could create such a wide dialog that some of the information would be clipped or outside the window. You can avoid this by formatting the output with the escape characters, such as \n for a break line.
Nazir is offline   Reply With Quote


Old 10-12-2006   #2 (permalink)
ScottHughes
Senior Member
 
Join Date: Sep 2006
Age: 22
Posts: 460
Default Re: Analysing Error Using alart

Thanks for this information. It helps to add these alerts, because that will save time in the long run when there's an error.
__________________
ScottHughes is offline   Reply With Quote

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
What HTTP error is generated when there is an error in an ASP page? agaba175 ASP 0 08-05-2006 08:25 PM


footer left
All times are GMT. The time now is 04:43 PM.

DISCLAIMER: preCharge Risk Management is not responsible for any opinions, advice or comments expressed on the preCharge Community Forums.
preCharge® is a registered trademark of preCharge Risk Management | chargeback protection | Merchant Account Blog

Powered by vBulletin
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC6

Internet Advertising | Debt Help | Online Loans | Hotel Santiago de Compostela | Debt Consolidation

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49