我有一张表格,我想用它来提交请假申请表。 我有字段名称,天数,理由,管理员电子邮件。
现在我正在使用MAILTO,但有一种方法可以在用户点击发送时实现。 MAILTO地址将使用经理电子邮件文本字段?
我的代码:
<html>
<body>
<form action="MAILTO:$email?subject=Application For Leave" method="post" enctype="text/plain">
<center><b>Alpine Motors Leave Application Form</b>
<br>
<br>
Date:
<input type="text" name="Date">
<br>
Name:
<input type="text" name="Name">
<br>
First Day of Leave:
<input type="text" name="First Day of Leave">
<br>
Last Day of Leave:
<input type="text" name="Last Day of Leave">
<br>
Number Of Days Taken:
<input type="text" name="Number Of Days Taken">
<br>
Managers Email:
<input type="text" name="Managers Email">
<br>
<br>
<br>
Applicants Signature:
<input type="text" name="Applicants Signature" value="_______________________________">
<br>
<b>THIS SECTION TO BE COMPLETED BY PERSONNEL DEPARTMENT</b>
<br>
<input type="submit" onclick="show_alert()" value="Send">
<input type="reset" value="Reset"></center>
</form>
</body>
</html>
答案 0 :(得分:0)
如果您想使用现有编码更改mailto,可以尝试
在邮件文本中添加ID:
Managers Email:
<input type="text" id="manager_email" name="Managers Email">
添加以下jquery
<script>
$(document).ready(function(){
$("form").submit(function( event ) {
var mail=$("#manager_email").val();
var action ="MAILTO:"+mail+"?subject=Application For Leave";
$(this).attr('action',action);
});
});
</script>