EasyUI的jQuery时间选取器小部件
EasyUI是一个HTML5框架,用于使用基于jQuery、React、Angular和Vue技术的用户界面组件。它有助于为交互式网络和移动应用程序构建功能,为开发者节省大量时间。
在这篇文章中,我们将学习如何使用jQuery EasyUI设计一个时间选择器。TimePicker widget是用来显示一个可以用来选择所需格式的时间的选择器。
EasyUI for jQuery的下载:
https://www.jeasyui.com/download/index.php
语法:
<input class="easyui-timepicker">
属性:
- closeText : 它是关闭按钮要显示的文本。
- okText : 它是确定按钮要显示的文本。
- value : 它是挑选器的默认时间。
- ampm :这些是AM和PM按钮的标签。
- hour24 : 它定义了是否以24小时格式显示时间。
方法:
- options。它返回选项对象。
- getValue。它获得组件的值。
- setValue。它设置组件的值。
- reset。它重置了组件的值。
CDN链接:首先,添加你的项目需要的jQuery Easy UI脚本。
<script type=”text/javascript” src=”jquery.min.js”></script>
<!–jQuery libraries of EasyUI –>
<script type=”text/javascript” src=”jquery.easyui.min.js”> </script>
<!–jQuery library of EasyUI Mobile –>
<script type=”text/javascript” src=”jquery.easyui.mobile.js”> </script>
示例 1:
<html>
<head>
<!-- EasyUI specific stylesheets-->
<link rel="stylesheet"
type="text/css"
href="themes/metro/easyui.css">
<link rel="stylesheet"
type="text/css"
href="themes/mobile.css">
<link rel="stylesheet"
type="text/css"
href="themes/icon.css">
<!-- jQuery library -->
<script type="text/javascript"
src="jquery.min.js">
</script>
<!-- jQuery libraries of EasyUI -->
<script type="text/javascript"
src="jquery.easyui.min.js">
</script>
<!-- jQuery library of EasyUI Mobile -->
<script type="text/javascript"
src="jquery.easyui.mobile.js">
</script>
<script type="text/javascript">
$('#gfg').timepicker({
hour24: false
})
</script>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h3>EasyUI jQuery timepicker widget</h3>
<!-- Define the EasyUI TimePicker
with markup -->
<input id="gfg" class="easyui-timepicker">
</body>
</html>
输出:
示例 2:
<html>
<head>
<!-- EasyUI specific stylesheets-->
<link rel="stylesheet"
type="text/css"
href="themes/metro/easyui.css">
<link rel="stylesheet"
type="text/css"
href="themes/mobile.css">
<link rel="stylesheet"
type="text/css"
href="themes/icon.css">
<!-- jQuery library -->
<script type="text/javascript"
src="jquery.min.js">
</script>
<!--jQuery libraries of EasyUI -->
<script type="text/javascript"
src="jquery.easyui.min.js">
</script>
<!--jQuery library of EasyUI Mobile -->
<script type="text/javascript"
src="jquery.easyui.mobile.js">
</script>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h3>EasyUI jQuery timepicker widget</h3>
<!-- Define the element that
will be used as the TimePicker -->
<input id='gfg'>
<script type="text/javascript">
// Initialize the EasyUI TimePicker
$('#gfg').timepicker({
hour24: false
});
</script>
</body>
</html>
输出: