salve
ho scritto il mio primo codice in javascript, ma nn capisco come mai il form viene spedito senza che i controlli vengano effettuati

posto il codice:


<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
--%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>

<script language="JavaScript" type="text/JavaScript">
<!--
function Convalida() {
var nome = document.Form.campo1.value;
var cognome = document.Form.campo2.value;
if (nome=='') {alert(“Campo obbligatorio!”)return false}
if (cognome=='') {alert(“Campo obbligatorio!”)return false}
return true;
}
//-->
</script>

</head>
<body>

<h1>JSP Page</h1>

<form name="Form" method="post" action ="/index.jsp" onSubmit="return Convalida()">
<input type="text" name="campo1" value="" />
<input type="text" name="campo2" value="" />
<input type="submit" value="ok" name="ok" />
</form>

</body>
</html>