我是一名网络开发专业的学生,​​我试图找到一种方法来感谢访问者,该访问者从我的网站提交了联系表。我想在感谢页面上按名称感谢他们。以下是我表格的代码。请帮助学生学习。

<form action="http://www.MySiteUrl/cgi-sys/formmail.pl" method="post" enctype="plain/text" id="Contact">
            <input name="Name" type="text" class="quoteboxes" id="Name" />

        <span class="textfieldRequiredMsg">Name is required.</span></span></div>
    <!-- End InputFavSite -->
     <div id="inputneed">
         <label>Email </label><span id="sprytextfield6">
         <input name="Email" type="text" class="quoteboxes" id="Email" />
         <span class="textfieldRequiredMsg">E-mail is required.</span><span class="textfieldInvalidFormatMsg">Opse! your E-mail is wrong.</span></span></div>
     <!-- End InputNeed -->
      <div id="inputbudjet"> <label>Phone </label><span id="sprytextfield7">
      <input name="Phone" type="text" class="quoteboxes" id="Phone" />
      <span class="textfieldRequiredMsg">Phone is required.</span><span class="textfieldInvalidFormatMsg">Opse! your number is wrong..</span></span></div>
      <!-- End InputBudget -->
       <div id="inputtime">
           <label>Subject </label>      <span id="sprytextfield8">

               <input name="Subject" type="text" class="quoteboxes" id="Subject" />

           <span class="textfieldRequiredMsg">Subject is required.</span></span></div>
       <!-- End InputTime -->
     <div id="ccontact"><span id="sprytextarea">
         <textarea name="Message" class="quotemessase" id="Message"></textarea>
         <span class="textareaRequiredMsg">Message is required.</span></span></div><!-- End QuoteButtRight -->
         <div id="contactbttn">
           <input name="sender" type="submit" value="click to send your message" />
         </div><!-- End ContactBttn -->

    </div><!-- End QuoteTopRight-->


    </div><!-- End QuoteTop -->

           <input type="hidden" name="recipient" value="[email protected]" />
    <input type="hidden" name="redirect" value="yourURL/Thankspage" />

    </form>

最佳答案

您可以在提交表单之前(使用javascript)将名称值保存到cookie中,然后使用javascript从cookie中获取它。

http://www.quirksmode.org/js/cookies.html

或使用服务器端语言(php等)

关于javascript - 提交联系表格后按名字感谢访客,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7656428/

10-11 14:56