我正在尝试在酒店预订管理器中使用此先前的代码,以在输入表单中选择当前日期(日,月,年)。我通过网站拖放生成器(Webflow)将代码直接嵌入到我的网页上的HTML代码块中。
而且我还希望出发日期可以自动选择当前日期之后的7天。
我发现这是我所寻找的Set current date in form select lists的最接近答案,但不知道如何将其实现到所讨论的代码中。
任何帮助将不胜感激。
这是我正在使用的代码:
/// Handles a frame arrived event and renders the frame to the screen.
/// </summary>
private void FrameReader_FrameArrived(MediaFrameReader sender, MediaFrameArrivedEventArgs args)
{
// TryAcquireLatestFrame will return the latest frame that has not yet been acquired.
// This can return null if there is no such frame, or if the reader is not in the
// "Started" state. The latter can occur if a FrameArrived event was in flight
// when the reader was stopped.
// Get frame image from camera:
using (MediaFrameReference frame = sender.TryAcquireLatestFrame()) // ==> MediaFrameReference
{
// Got image?
if (frame != null)
{
// DIAG: Save image data to file for analysis:
// Get image byte data:
DataReader dataReader = DataReader.FromBuffer( frame.BufferMediaFrame.Buffer );
byte[] camera_image_bytes = new byte[ frame.BufferMediaFrame.Buffer.Length];
dataReader.ReadBytes( camera_image_bytes );
// Save to file :
var len = camera_image_bytes.Length;
System.IO.File.WriteAllBytes( "C:\\PRIMARY\\WORK\\CAMERA READER\\camera_image_bytes.bin", camera_image_bytes ); <<<<<<<<<<< E R R O R H E R E
...
答案 0 :(得分:0)
希望这对您有所帮助。
您的html离开部分看起来像这样。只需添加相关ID以选择标签即可。
<td>
<span>Departure:</span>
</td>
<td>
<select name="COM" size="1" id="departureMonth">
<!-- COM = CheckOutMonth -->
<option value="1">Jan</option>
<option value="2">Feb</option>
<option value="3">Mar</option>
<option value="4">Apr</option>
<option value="5">May</option>
<option value="6">Jun</option>
<option value="7">Jul</option>
<option value="8">Aug</option>
<option value="9">Sep</option>
<option value="10">Oct</option>
<option value="11">Nov</option>
<option value="12">Dec</option>
</select>
</td>
<td>
<select name="COD" size="1" id="departureDay">
<!-- COD = CheckOutDay -->
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
</td>
<td>
<select name="COY" size="1" id="departureYear">
<!-- COY = CheckOutYear -->
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
</select>
</td>
并添加此javascript + jquery代码。
var departureDate = new Date();
departureDate.setDate(departureDate.getDate()+7);
$("#departureYear").val(departureDate.getFullYear());
$("#departureMonth").val(departureDate.getMonth());
$("#departureDay").val(departureDate.getDate());