Easy-UI中datebox的默认显示当前日期的最简单的两种方法


在中有一个Today按钮就是实现显示当前日期,所以我们在src/jquery.datebox.js文件中可以找到currentText:'Today'。
所以我们可以使用'currentText'和'Today'来默认显示当前日期。
1.使用属性data-options="value:'currentText'"data-options="value:'Today'"
2.使用javascript设置$('#datebox1').datebox('setValue','Today')$('#datebox1').datebox('setValue','currentText');

------------------------------------题外话------------------------------------
Easy-UI使用一般需要引入2个css文件和2个js文件即可,文件名如下:
<link rel="stylesheet" type="text/css" href="jquery-easyui-1.5.5/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="jquery-easyui-1.5.5/themes/icon.css">
<script type="text/javascript" src="jquery-easyui-1.5.5/jquery.min.js"></script>
<script type="text/javascript" src="jquery-easyui-1.5.5/jquery.easyui.min.js"></script>

最后,如果想要datebox显示的是中文,那么请在jquery.easyui.min.js引入locale/easyui-lang-zh_CN.js即可。

提醒:使用easy-UI框架,javascript出现"Uncaught TypeError: Cannot read property 'options' of undefined" /xxx/jquery-easyui-1.5.5/jquery.easyui.min.js (15933)报错时,有可能是你写的javascript代码没有放在window.onload=function(){}$(function(){})之中。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM