码迷,mamicode.com
首页 > 其他好文 > 详细

datepickerx设置默认日期

时间:2016-08-27 12:41:43      阅读:991      评论:0      收藏:0      [点我收藏+]

标签:

datepicher插件是jQuery UI的一个插件,它提供一个日期弹出窗口(或直接显示在页面),供用户选择日期。在Web开发中,总会遇到需要用户输入日期的情况。一般都是提供一个text类型的input供用户输入日期,我们在实际开发中会遇到给日期控件设置默认日期的情况,下面我们就举例解释jquery easyui datepickerx控件是如何实现设置默认日期的:

<%@page pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@include file="/coframe/tools/skins/common.jsp" %>
<%@taglib uri="http://org.gocom.components.authTag/tag" prefix="auth" %>
<%@include file="/common.jsp" %>
<html>
<!-- 
  - Author(s): caowenliang
  - Date: 2016-07-15 12:08:01
  - Description:
-->
<head>
<title>回款里程碑审核</title>
<style type="text/css">
.New_Button, .Edit_Button, .Delete_Button, .Update_Button, .Cancel_Button
{
    font-size:11px;color:#1B3F91;font-family:Verdana;  
    margin-right:5px;
}
.monthrow
{
    background:#fceee2;
}  
</style>
<body>    
 <div>
    <div id="form1" style="padding-top:0px;">
        <fieldset style="width:97%;height:100%;border:solid 1px #aaa;margin-top:0px;position:relative;">
        <legend>申请信息</legend>
            <div><label>完工日期:</label>
                <td><input id="rfinish_date" class="nui-datepickerx" enabled="false"/></td>    
                <td><input id="attachmentId" class="nui-hidden"/></td>
                </div>
                <fieldset style="float:left;width:40%;height:150px;border:solid 1px #aaa;margin-top:0px;position:relative;">
                    <legend>附件信息</legend>
                    <div class="nui-toolbar;" style="border-bottom:0;padding:0px;">
                        <table >
                            <tr><!-- 文件上传 -->
                               <td style="width:40%">下载附件:</td> 
                                   <td style="white-space:nowrap;" ><div id=‘download‘></div></td>
                                <td >                                   
                                    <input id="fileid" name="dpGdAdj.fileid" class="nui-hidden" />
                                   </td>
                            </tr>
                        </table>
                    </div>
                </fieldset>
                <fieldset style="float:right;border:solid 1px #aaa;margin-top:0px;position:relative;width:54%;height:150px;">
                <legend>交付物计划</legend>
                    <div class="nui-fit">
                    <div id="datagrid1" class="nui-datagrid" style="width:100%;height:100%;" dataField="data"
                        url="com.shtech.dp2.prjplan.ProjectManager.queryPod.biz.ext" multiSelect="true"
                        allowCellEdit="true" allowCellSelect="true" editNextOnEnterKey="true" 
                        idField="podid" showPager="false"  showFooter="false" allowSortColumn="false">
                        <div property="columns">
                            <div type="checkcolumn"></div>
                            <div field="podid" visible="false"><!-- 交付物ID --></div>
                            <div field="podname" width="100" headerAlign="center" allowSort="true" vtype="required">交付物名称
                                <input property="editor" class="nui-textbox" style="width:100%;" maxLength="25"/>
                            </div>
                            <div field="comcriteria" width="60" renderer="renderComcriteria" allowSort="true" align="center" headerAlign="center">完成标准
                                <input property="editor" class="nui-dictcombobox" dictTypeId="DP2_COMCRITERIA" />
                            </div>
                            <div field="carrformat" width="70" renderer="renderCarrformat" allowSort="true" align="center" headerAlign="center">载体形式
                                <input property="editor" class="nui-dictcombobox" dictTypeId="DP2_CARRFORMAT" />
                            </div>
                            <div field="demandtype" width="60" renderer="renderDemandtype" allowSort="true" align="center" headerAlign="center">要求来源
                                <input property="editor" class="nui-dictcombobox" dictTypeId="DP2_DEMANDTYPE" />
                            </div>
                            <div field="baseline" width="70" renderer="renderBaseline" allowSort="true" align="center" headerAlign="center">基线名称
                                <input property="editor" class="nui-dictcombobox" dictTypeId="DP2_BASELINE" />
                            </div>                
                            <div type="comboboxcolumn" field="gcMscellid" width="100" headerAlign="center" vtype="required" >所属里程碑
                                <input property="editor" class="nui-combobox" style="width:100%;" 
                                data="listData" />                
                            </div>
                        </div>
                    </div> 
                 </div>
                </fieldset>
                <table>
                    <label>差异说明:</label>
                    <td><textarea id="note" class="nui-textarea" style="width:860px;" emptyText="请输入差异说明" ></textarea></td>               
                    </tr>                    
              </table>
        </fieldset>
         <fieldset style="width:97%;height:100%;border:solid 1px #aaa;margin-top:4px;position:relative;">
             <label>确认日期:</label>
                <td><input id="cfmddate" class="nui-datepickerx" required="true"/></td></br>
             <table>
                    <label>审批意见:</label>
                    <td><textarea id="note" class="nui-textarea" style="width:860px;" emptyText="请输入审批意见" ></textarea></td>               
                    </tr>                    
                    <tr>
                        <td style="text-align:center;">
                           <a class="nui-button" iconCls="icon-save" onclick="onok">通过</a>
                           <span style="display:inline-block;width:1;"></span>
                           <a class="nui-button" iconCls="icon-save" onclick="no">驳回</a>
                           <span style="display:inline-block;width:25px;"></span>
                           <a class="nui-button" iconCls="icon-cancel" onclick="onCancel">取消</a>
                        </td>
                     </tr>
              </table>
          </fieldset>
         <div>
            </div>
    </div>
    </div>        
</div>
</body>
<script type="text/javascript">
   nui.get("rfinish_date").setValue(new Date());
   nui.get("cfmddate").setValue(new Date());
</script>   
</html>

 看页面展示效果:

技术分享

datepickerx设置默认日期

标签:

原文地址:http://www.cnblogs.com/Devin-Blog/p/5812733.html

(0)
(1)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!