After testing a jsp, I went to add a few comments and inadvertantly deleted an opening brace in a javascript function…
Even after putting this little javascript function in its own .js file, myeclipse did not report an error.. by leaving off one opening brace, the code closes off the function, and leaves a couple of statements dangling with the original closing brace..that should definitely trigger a syntax error,right?
my question’s are
1) is the JSP editor not javascript aware (it seems to only notice the html script tag)
2) is the javascript editor just highlighting keywords and nothing more?
3) what is the ‘best practices’ for avoiding this kind of issue (ie. javascript bugs).
<script>
function exec_form( frm, reqAction ) {
if (reqAction == "test") {
frm.dotest.value="go";
frm.DFS__Step.value = 2;
}
if (reqAction == 'cancel') // brace missing
window.close();
return false;
} // to compiler/interpreter, this closes the fucntion
frm.submit(); // next 3 statements are dangling
return true;
} //this should be syntax error
</script>