大家好!有没有人知道如何通过按一个按钮将日期和时间输入到单个文本框? [英] Hello everyone! Does anyone know how to input date and time to a single textbox just by pressing a single button ?

查看:67
本文介绍了大家好!有没有人知道如何通过按一个按钮将日期和时间输入到单个文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!



有没有办法只需按一个按钮就可以在单个文本框中输入日期和时间?



我使用visual studio来做我的网站(ASP.net),谢谢你。

Hello everyone!

Is there a way to input date and time to a single textbox just by pressing a single button ?

I am using visual studio to do my website (ASP.net), thank you in advance.

推荐答案

在JavaScript中在客户端上执行:在文本框onkeypress事件中添加处理程序,并使用此处的代码顶部偏移日期: http://stackoverflow.com/questions/10098038/how-can-i-insert-date-and -time-into-input-field-via-a-button-click [ ^ ]



平板电脑自动纠正:咖啡为代码[/ edit]
Do it on the client in JavaScript: Add a handler to the textbox onkeypress event, and use the code from here top offset the date: http://stackoverflow.com/questions/10098038/how-can-i-insert-date-and-time-into-input-field-via-a-button-click[^]

[edit] tablet auto correct: "coffee" for "code"[/edit]


请,我想警告你:如果你要提供如此不确定的信息,没有多少人会同意帮助你,理所当然地认为这是浪费时间。第一个关键部分:你没有说这是网站(因此是ASP.NET)。第二,更重要的一点:你没有首先提到当前时间。没关系,但是在问你未来的问题之前请先考虑一下。



答案是:



客户端: https://msdn.microsoft.com/en -us / LIBRary / ff679974%28v = vs.94%29.aspx [ ^ ]。



服务器端:

https://msdn.microsoft.com/en-us /library/system.datetime.now(v=vs.110).aspx [ ^ ],

https://msdn.microsoft.com/en-us/library/system.datetime.utcnow(v=vs.110 ).aspx [ ^ ]。



要从服务器部分获取它,您需要发送HTTP请求并获取HTTP响应。你没有问过这件事;这是关于ASP.NET的基础知识。



-SA
Please, I want to warn you: if you are going to provide so uncertain information, not many will agree to help you, rightfully considering it as a waste of time. First key piece: you did not say that this is Web site (hence ASP.NET). Second, even more important piece: you did not mention "current time" in first place. It's all right, but please think about it before asking your future questions.

The answer would be:

Client side: https://msdn.microsoft.com/en-us/LIBRary/ff679974%28v=vs.94%29.aspx[^].

Server side:
https://msdn.microsoft.com/en-us/library/system.datetime.now(v=vs.110).aspx[^],
or https://msdn.microsoft.com/en-us/library/system.datetime.utcnow(v=vs.110).aspx[^].

To get it from server part, you need to send HTTP request and get HTTP response. You did not ask about it; it's about the very basics of ASP.NET.

—SA


这篇关于大家好!有没有人知道如何通过按一个按钮将日期和时间输入到单个文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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