function errorClass(){ var myError = null; this.standardErrorMsg = "Unfortunately, we cannot complete your quote unless you answer all the questions on the page. Please make sure you have answered our questions about:\n\n"; this.setError=function(msg){ myError = msg; } this.addError=function(msg){ if(myError==null) myError = msg; else myError = myError + "\n" + msg; } this.getError=function(){ return myError; } this.display=function(){ alert(this.standardErrorMsg+this.getError()); } } var error = new errorClass();