欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-06-23 20:38:34
在datebox中有一个Today按钮就是实现显示当前日期,所以我们在src/jquery.datebox.js文件中可以找到currentText:'Today'。 所以我们可以使用'currentText'和'Today'来默认显示当前日期。 ......

在中有一个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(){})之中。