电子邮件未生成或脚本未触发?

时间:2013-08-15 17:28:57

标签: javascript asp.net email

我有这个工作来生成一封电子邮件,但如果“ComplaintTextbox”包含超过30个字符,则不会生成电子邮件。??

<script type="text/javascript">
   function sendMail(CustomerTextbox, AddressTextBox, CityTextBox, StateDropDown, ZipTextBox, ModelTextbox, SerialTextbox, ReferenceTextbox, ComplaintTextBox, WarrentyTextBox) {
   var CustomerTextbox = document.getElementById(CustomerTextbox).value;
   var AddressTextBox = document.getElementById(AddressTextBox).value;
   var CityTextBox = document.getElementById(CityTextBox).value;
   var StateDropDown = document.getElementById(StateDropDown).value;
   var ZipTextBox = document.getElementById(ZipTextBox).value;
   var ModelTextbox = document.getElementById(ModelTextbox).value;
   var SerialTextbox = document.getElementById(SerialTextbox).value;
   var ReferenceTextbox = document.getElementById(ReferenceTextbox).value;
   var ComplaintTextBox = document.getElementById(ComplaintTextBox).value;
   var WarrentyTextBox = document.getElementById(WarrentyTextBox).value;

   var body = "Please issue a RMA for this case." + "\r\n";
   body += CustomerTextbox + "\r\n";
   body += AddressTextBox + "\r\n";
   body += CityTextBox + "\r\n";
   body += StateDropDown + "\r\n";
   body += ZipTextBox + "\r\n";
   body += ModelTextbox + "\r\n";
   body += SerialTextbox + "\r\n";
   body += ReferenceTextbox + "\r\n";
   body += ComplaintTextBox + "\r\n";
   body += WarrentyTextBox + "\r\n";

1 个答案:

答案 0 :(得分:0)

你不应该用这个引起完整的回发。您正尝试使用ASP.NET提交按钮调用javascript函数,只需更改此

即可
<a href="javascript:void(0)" onclick="sendMail('<%=CustomerTextbox.ClientID %>')">
            <asp:Button ID="cmdEmail1" runat="server" Text="Generate Email RMA" 
                Width="158px" />
            </a> 

到此:

  <a href="#" onclick="sendMail('<%=CustomerTextbox.ClientID %>')">
            Generate Email RMA
            </a> 

将开始使您的Web开发生活更轻松,更具可扩展性。