Mega Code Archive

 
Categories / JavaScript DHTML / Development
 

Debugging Using alert() Methods html

<html> <body> <script language="JavaScript"> var myVariable; var yourVariable;     function setType() {   alert("Inside the setType function.");  //Debug statement   return(yourVariable="truck"); }     function setColor() {   alert("Inside the setColor function.");  //Debug statement   return(myVariable="blue"); }     //Debug statement alert("Before if statement: type="+yourVariable+" color="+myVariable);     if(setType() || setColor()) {   //Debug statement   alert("After if statement: type="+yourVariable+" color="+myVariable);   document.write("The " + yourVariable + " is " + myVariable); } else   alert("The vehicles could not be set");     </script>     </body> </html>