View Single Post
  #4 (permalink)  
Old 09-18-03, 11:23 AM
pat@barelyfitz.com pat@barelyfitz.com is offline
Newbie Coder
 
Join Date: Aug 2003
Location: Atlanta, GA, USA
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Not the most elegant solutions, but you can wrap your script inside a labeled block:

Code:
MY_SCRIPT: {

document.write("<p>testing 1");
break MY_SCRIPT;
document.write("<p>testing 2");

} // MY_SCRIPT label
Or you can use try...catch and throw an exception:

Code:
try {

  document.write("<p>testing 1");
  throw("brokeout");
  document.write("<p>testing 2");

} catch (err) {
 document.write("<p>err = " + err);
}
Reply With Quote