不仅在刷新站点时,一直以弹出形式更新日期

时间:2014-06-14 22:14:41

标签: javascript jquery html django

当我调用弹出窗口时,如何更新字段中的日期和时间值? 因为在我的情况下,日期时间django在刷新时更新。

我的弹出窗口:

$(document).ready(function(){
    PopUpHide();
});
function PopUpShow(){
    $("#popup1").show();
    $(document).keyup(function(ev){
    if(ev.keyCode == 27)
        $("#popup1").hide();
    });
}
function PopUpHide(){
    $("#popup1").hide();
}

在html表格中弹出:

<div class="b-popup b-popup-content" id="popup1">
  <div class="cleanuphtml-1">
    Add 'problem' item
  </div>
  <form action="" method="post">
    {% csrf_token %} <input id="id_pk_post" value="1" maxlength="1" name="pk_post" type="text" /> <input id="id_post_request" value="1" maxlength="1" name="post_request" type="text" />
    <div class="cleanuphtml-2">
      <label for="id_description_post">Description:</label> 
      <textarea id="id_description_post_id" maxlength="9999" name="description_post" autofocus="" onkeyup="enableField(this.form,this.value)" type="text">
      </textarea>
    </div>
    <div class="cleanuphtml-4">
      <label for="id_start_date">Start date : <input type="text" name="start_date" id="datetimepicker" />     <label>End date :</label> <input type="text" name="end_date" id="datetimepicker2"
      class="cleanuphtml-3" /></label>
    </div>
    <div class="cleanuphtml-6">
      <p class="cleanuphtml-5">
        <label>Priority :</label> <select method="post" name="priority_post">
          <option value="1" id="id_priority_post" name="priority_post">
            High
          </option>
          <option value="2" id="id_priority_post" name="priority_post">
            Medium
          </option>
          <option value="3" id="id_priority_post" name="priority_post" selected="selected">
            Low
          </option>
        </select>
      </p>
    </div>
    <div class="cleanuphtml-9">
      <input type="submit" name="bttnsubmit" value="Add" onclick="window.location.href='/'" disabled="true" class="cleanuphtml-7" /> <input type="button" value="Cancel" onclick="PopUpHide()"
      class="cleanuphtml-8" />
    </div>
  </form>
</div>

这是使用名为calendar的jquery:

$('#datetimepicker').datetimepicker()
    .datetimepicker({value:'{{ now_date|date:'Y-m-d H:i' }}',step:10});

0 个答案:

没有答案