function send(){
var errorString = validate();
if(errorString.length > 0){
errorString = "您產生下列錯誤:\n" + errorString ;
alert(errorString);
}else{
document.form1.submit();
}
}
function validate(){
var errorString = "";
if(document.form1.order_name.value==""){
errorString = errorString + "請輸入訂購人姓名\n";
}
return errorString;
}
-----------------------------------------------------------------
<form name="form1" method="post" action="confirmation.php" onSubmit="send();return false">
沒有留言:
張貼留言