简体   繁体   English

用户单击提交按钮时如何获取显示的时间

[英]How do I fetch displayed time when user clicks submit button

I have this code which displays present time.我有显示当前时间的代码。 User clicks submit button and the exact present time should get saved in mysql table.用户单击提交按钮,准确的当前时间应保存在 mysql 表中。 But I cant figure out how to do it.但我不知道该怎么做。

<!DOCTYPE html>
<html>
<style>
p{font-family:Verdana;}
</style>
<body>

<p>The Current time is:</p>
<p id="example"></p>

<script>
var display=setInterval(function(){Time()},0);

function Time()
{
var date=new Date();
var time=date.toLocaleTimeString();
document.getElementById("example").innerHTML=time;
}
</script>

</body>
</html>  

Lets the user clicks "SUBMIT" button at time 8:02:43 PM, then this time should get stored in mysql table called time让用户在 8:02:43 PM 时间单击“提交”按钮,然后这个时间应该存储在 mysql 表中,称为time

You should have a server, for example, Grails or any other web server and have an controller endpoint over there.您应该有一个服务器,例如Grails或任何其他 web 服务器,并在那里有一个 controller 端点。 Then you can save it to MySQL database using Grails repository然后您可以使用 Grails 存储库将其保存到 MySQL 数据库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当用户单击按钮时如何防止作弊 - How do I prevent cheating when user clicks a button 用户单击按钮时,图像无法正确显示 - Image is not displayed correctly when user clicks on button Rails-用户单击提交按钮时如何更新表中的数据 - Rails - How update data in table when user clicks on submit button 用户单击提交按钮时如何调用两个不同的网页? - How to call two different webpages when the user clicks submit button? 当用户单击“提交”按钮时如何防止退出时发出JavaScript警报 - How to prevent javascript alert on exit when user clicks on submit button 当用户单击“提交”按钮时,如何为变量分配任意值? - How to assign an arbitrary value to a variable when user clicks submit button? 用户点击它时隐藏(或禁用)提交按钮 - Hide (or disable) submit button when user clicks on it 当用户单击选择标记上的提交时,如何使“选择一个”选项不通过? - How do I make the “select one” option not go through when the user clicks submit on the select tag? 每次用户单击按钮时,如何按顺序浏览链接列表? - How do I sequentially go down a list of links each time a user clicks a button? 每当用户单击同一按钮时,如何显示N个div? - How do I show N divs every time user clicks same button?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM