我有一个用 Html 创建的表单和一个 VBScript,用于将文件写入 Pickup 文件夹,以便将电子邮件发送到某个地址。我想用表单数据作为变量替换或添加到写入脚本中的当前字段。我将使用什么 VBscript 来实现这一点?我还希望通过提交按钮调用脚本我该怎么做?
这是我的表单 HTML:
<!doctype=html>
<html>
</div>
<body onload="window.resizeTo(750,800)">
<div align="left">
<font face="calibri" size="4">
<p><b>Thank you!!</b> …For taking the time to offer your subjects to the senior management via this Stakeholder forum. Please fill out the required information on the front sheet below. Use as many additional sheets as necessary.</p>
<form>
<p>
<fieldset>
<font color="0000FF">1)</font > Date of your submission <font color="grey" size="3">(__/__/20__)</font>:<br> <input type="date" STYLE= "background-color: #FFFF00" name="__/__/20__"><br>
</fieldset>
</p>
<p>
<fieldset>
<font color="0000FF">2)</font> Give Your submission a name: <font color="grey" size="3"> (This can be any inoffensive word or phrase at all… even if it doesn’t relate to the nature of the subject) </font><br>
<input type="text" STYLE= "background-color: #FFFF00" name="Submission Name">
</fieldset>
</p>
<p>
<fieldset>
<font color="0000FF">3)</font> This Submission includes:<br>
<select>
<option value="Select..."STYLE= "background-color: #FFFF00">Select...</option>
<option value="Polite and detailed rant (no proposed solution(s) )" STYLE= "background-color: #FFFF00">Polite and detailed rant (no proposed solution(s) )</option>
<option value="Problem(s) / area(s) for improvement with proposed solution(s)" STYLE= "background-color: #FFFF00">Problem(s) / area(s) for improvement with proposed solution(s)</option>
<option value="New Idea(s) / Resurrected old idea(s)" STYLE= "background-color: #FFFF00">New Idea(s) / Resurrected old idea(s)</option>
<option value="Abstract / Other" STYLE= "background-color: #FFFF00">Abstract / Other</option>
</select>
</fieldset>
</p>
<p>
<fieldset>
<font color="0000FF">4)</font> Indicate which areas of our business this submission is connected with… <font color="grey" size="3"> (delete as applicable) </font><br>
<select>
<option value="Select..."STYLE= "background-color: #FFFF00">Select...</option>
<option value="Customer / Supplier Aspects"STYLE= "background-color: #FFFF00">Customer / Supplier Aspects</option>
<option value="Financial Performance" STYLE= "background-color: #FFFF00">Financial Performance</option>
<option value="Innovation and growth" STYLE= "background-color: #FFFF00">Innovation and growth</option>
<option value="Internal Business/Systems" STYLE= "background-color: #FFFF00">Internal Business/Systems</option>
</select>
</fieldset>
</p>
<p>
<fieldset>
<font color="0000FF">5)</font> Personal Details:<font color="grey" size="3"> (optional) </font><br>
First name: <input type="text" STYLE= "background-color: #FFFF00" name="firstname"><br>
Last name: <input type="text" STYLE= "background-color: #FFFF00" name="lastname"><br>
Contact Number: <input type="text" STYLE= "background-color: #FFFF00" name="contactnumber">
</fieldset>
</p>
<p>
<fieldset>
<font color="#0000ff">6)</font> The details of your submission… remembering to avoid:<br>
<ul>
<li>Cases that are associated with just one single individual. These type of subjects are best dealt with outside of this forum</li>
<li>Vulgarities and or insults.</li>
</ul>
<textarea rows="10" cols="50" col width= "100" STYLE= "background-color: #FFFF00">Dear senior management...
</textarea>
这是我用于写入文件的 VBscript:
Set objFSO=CreateObject("Scripting.FileSystemObject")
' How to write file
outFile="\\location\file.txt"
Set objFile = objFSO.CreateTextFile(outFile,True)
objFile.Write "to:email1@mail.com" & vbCrLf
objFile.Write "from:email2@mail.com" & vbCrLf
objFile.Write "subject:This is a test." & vbCrLf
objFile.Write ("") & vbCrLf
objFile.Write "This is the body of the email." & vbCrLf
objFile.Close