如何在文本框中设置hh:mm [英] how to set hh:mm in textbox

查看:172
本文介绍了如何在文本框中设置hh:mm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在文本框中设置hh:mm,在文本框中显示当前时间,如
10:45,以便用户可以编辑时间11:48,分号不应编辑.,

How to set hh:mm in textbox., show current time in textbox like
10:45 so user can edit time 11:48, semicolon should not edit.,

推荐答案

对于文本框中的HH:mm格式,您必须屏蔽文本框


For HH:mm format in Textbox you have to mask the textbox


<pre lang="HTML">

< html xmlns =" http://www.w3.org/1999/xhtml>
< head runat ="server">
< title>无标题页面</title>
< script type ="text/javascript" src ="jquery.js"></script>
< script type ="text/javascript" src ="jquery.maskedinput.js"></script>
</head>
< body>
< form id ="form1" runat ="server">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.maskedinput.js"></script>
</head>
<body>
<form id="form1" runat="server">


< asp:textbox runat ="server" id ="txt1" text ="99:99" xmlns:asp =#unknown">

<asp:textbox runat="server" id="txt1" text="99:99" xmlns:asp="#unknown">


</form>
</body>
< script type ="text/javascript">


</form>
</body>
<script type="text/javascript">


(function(){

(function () {


(#txt1").mask("99:99");
});
</script>
</html>



//////////////////////
Jquery.js jquery.maskedinput.js 附加到页面上
这是jquery.maskedinput.js
///////////////////


/*
*版权所有(c)2007 Josh Bush(digitalbush.com)
*
*特此免费授予任何人
*获得此软件和相关文档的副本
*文件(软件"),无需使用软件即可处理软件
*限制,包括但不限于使用权,
*复制,修改,合并,发布,分发,再许可和/或出售
*本软件的副本,并允许
的人 *提供软件以符合以下条件
*条件:

*以上版权声明和此许可声明应为
*包含在本软件的所有副本或主要部分中.
*
*该软件按原样"提供,没有任何形式的保证,
*表示或暗示,包括但不限于保修
*适销性,特定目的的适用性和
*非侵权.在任何情况下,作者或版权均不得拥有
*持有人对任何索赔,损坏或其他责任承担责任,
*无论是在合同,侵权或其他情况下引起的诉讼,
*来自,与软件或使用或使用有关或与之相关或
*软件中的其他处理.
*/

/*
*版本:RC3
*发布:2007年7月1日
*/
(函数(
("#txt1").mask("99:99");
});
</script>
</html>



////////////////////////
Attach Jquery.js and jquery.maskedinput.js to your page
This is jquery.maskedinput.js
/////////////////////


/*
* Copyright (c) 2007 Josh Bush (digitalbush.com)
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:

* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/

/*
* Version: RC3
* Release: 2007-07-01
*/
(function (


这篇关于如何在文本框中设置hh:mm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆