日期:2014-05-16  浏览次数:20385 次

javascript 发邮件问题
<table   width= "640 "   height= "20 "   border= "0 "   cellpadding= "0 "   cellspacing= "0 ">
    <form   action= "mailto:test@sohu.com "   enctype= "multipart/form-data "   name= "email "   id= "email ">
        <tr>
            <td   width= "98 "   class= "url_main "> 姓名 </td>
            <td   width= "515 "> <input   name= "username "   type= "text "   id= "username "> </td>
        </tr>
        <tr>
            <td   class= "url_main "> 邮件 </td>
            <td> <input   name= "email "   type= "radio "   value= "1@163.com "   checked> 1
                    <input   name= "email "   type= "radio "   value= "2@163.com "> 2
                    <input   name= "email "   type= "radio "   value= "3@163.com "> 3
                    <input   name= "email "   type= "radio "   value= "4@163.com "> 4
          </td>
        </tr>
        <tr>
            <td   colspan= "2 "> <input   type= "submit "   name= "Submit "   value= "Submit "> </td>
        </tr>
    </form>
</table>

请问   我点提交   如何实现   发送的邮件地址是用户选择的email的那个邮件地址呢?谢谢

------解决方案--------------------
<script language= "javascript ">
function sendmail() {
var msg = document.forms[0].username.value;
var com = document.forms[0].email;
var mm;
for (var i =0;i <com.length;i++) {
if (true == com[i].checked) {
mm = com[i].value;
}
}
var contentm = msg+mm;
document.forms[0].action = "mailto: "+ contentm;
}
</script>
<table width= "640 " height= "20 " border= "0 " cellpadding= "0 " cellspacing= "0 ">
<form action= " " enctype= "multipart/form-data " name= "email " id= "email ">
<tr>
<td width= "98 " class= "url_main "> 姓名 </td>
<td width= "515 "> <input name= "username " type= "text " id= "username "> </td>
</tr>
<tr>
<td class= "url_main "> 邮件 </td>
<td> <input name= "email " type= "radio " value= "1@163.com " checked> 1
<input name= "email " type= "radio " value= "2@163.com "> 2
<input name= "email "