だから私は、電子メールアドレスを受け入れ、それらをWebフォームに送信するhtmlでjavascript関数を作成しようとしています。どうすればいいですか?これは私がこれまでに持っているものです:
<html>
<form name="form" method="post" action="form-action.php">
<label>
Email:
</label>
<input type="email" name="email"
id="email" size="25" />
<input type="button" value="Submit" onclick="SubmitEmail()" />
</form>
<script type="text/javascript">
function SubmitEmail() {
if (!ValidateForm()) {
return false;
}
document.getElementById("form").submit();
function ValidateForm() {
if (document.getElementById('email').value.length === 0) {
alert("Email is Required");
return false;
}
document.getElementById('EmailRslt').value = document.getElementById('email').value;
return true;
}
</script>
<td>Your Email is:
</td>
<td id="EmailRslt"></td>
</html>