我需要一个 html 表单的时间戳输入。不知道这是否可能,但我才刚刚开始

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15489603/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 06:39:13  来源:igfitidea点击:

I need a timestamp input for an html form. Don't know if this is possible but I'm just starting out

htmlinput

提问by John E

So like I say i dont know if I am doing any of this correctly but I am basically teaching myself and I don't seem to be able to find anything about having a timestamp input field. It is actually for inputting timestamps from movies.

所以就像我说的,我不知道我是否正确地做任何这些,但我基本上是在自学,我似乎无法找到任何关于时间戳输入字段的信息。它实际上是用于输入电影的时间戳。

<div id="form"><form>
First Name: <input type="text" name="firstname">
Last Name: <input type="text" name="lastname">
Movie Title: <input type="text" name="movietitle">
<p>Is the drink...</p>
<input type="radio" name="drinktype" value="alcoholic">Alcoholic
<input type="radio" name="drinktype" value="soft">Non-alcoholic
<p>What exact time did the Buffalo occur during the movie?</p>
<input type="time" name="timestamp"><br>
<input type="submit" value="Submit">
</form></div>

I'm not showing anything CCS-wise for this because what I really want to know how to do is a timestamp input field first in this format hh:mm:ss

我没有为此显示任何 CCS 明智的东西,因为我真正想知道如何做的是首先采用这种格式的时间戳输入字段 hh:mm:ss

Appreciate the help!

感谢帮助!

采纳答案by pckill

You can use stepattribute in your inputtag:

您可以stepinput标签中使用属性:

<input type="time" name="timestamp" step="1">

W3C: input: type=time

W3C:输入:类型=时间