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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to debug

Status
Not open for further replies.

cat5ive

MIS
Dec 3, 2004
184
US
Hi,

What's the equivalent statement to these 2 statements in jv script?
response.write("stop")
response.end

Thanks in advance
 
document.write("stop")

and

no substitute for Response.End.

[monkey][snake] <.
 
cat5ive, in terms of debugging, document.write is not always the best method because it will only write data to the page when the page is loaded. If you are debugging a javascript function that occurs after the page has been loaded like in response to a click event, document.write will not help you.

An alert box is useful for displaying information during javascript execution to give you the current value of a variable or alert you that the script has executed a particular piece of code, etc.
Example:
Code:
function myFunction() {
  var myValue = document.getElementById('myField').value;
  alert(myValue);
}
This would popup a message displaying the value of the form field myField. If the field did not exist though javascript would throw an error and code execution would stop and the alert would never occur.
You can also use try/catch blocks in javascript to test the execution of statements and catch/respond to errors so they do not cause execution to stop.
You can search on Javascript debugging or Javascript error detection or error trapping for more info.
Also, if you use Firefox you can use it's Javascript Console to give you much more information about any script errors that occur. It is very useful in tracking down and fixing bugs in the script.


At my age I still learn something new every day, but I forget two others.
 
Heh, I just answer the question asked in the post. I didn't even pay attention to the subject.

[monkey][snake] <.
 
If you use Firefox (what am I saying.. of COURSE you use Firefox... it's the best browser for web development... why wouldn't you be using Firefox) - then you ought to take a look at the Firebug browser extension. It will open up a whole new world of breakpoints, variable watching, CSS editing and hot code changing... not to mention debugging. Then you can debug your web application [smile]

Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Firefox has saved me 10000000 times in the past for debugging javascript.

IE's error descriptions are way too specific for me, too much detail. [smile]

[monkey][snake] <.
 
Heh, I just answer the question asked in the post. I didn't even pay attention to the subject.

Well, I had the benefit of having read your response already. If I were the first responder I may very well have said the same thing you did and answer the specific question. When reading the responses I come up with new answers. B-)

At my age I still learn something new every day, but I forget two others.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top