Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
423 views
in Technique[技术] by (71.8m points)

javascript - 更改类型为“时间”的输入字段的值(Changing the value of an input field of type:“time”)

This is about a system where users can enter their company open and closing times.(这是关于用户可以输入公司营业时间和营业时间的系统。)

I have 7 fields which are equal to 7 days <input type="time"> , these are populated with times from a database.(我有7个字段,它们等于7天<input type="time"> ,这些字段中填充了来自数据库的时间。) This input has a default display of --:-- but when you change it to that the value of the field is not adjusted.(此输入的默认显示为-:-,但将其更改为该字段的值不会被调整。) What I want is the following: Whenever a user submits the form and a field display consists of --:-- , I want to change the value of that field to -1 .(我想要的是以下内容:每当用户提交表单并且字段显示由-:-组成时,我都希望将该字段的值更改为-1 。) Why?(为什么?) Because -1 means that a company is closed on that day.(因为-1表示该公司在那一天关闭。) How can I achieve this?(我该如何实现?) Example:(例:) 在此处输入图片说明   ask by thomas translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The explanation of the problem is not very clear but if you want to display a value from database you can disable the input field and display a value in it with the value=(问题的解释不是很清楚,但是如果您要显示数据库中的值,则可以禁用输入字段,并使用value=在其中显示value=)

Here an example:(这里是一个例子:) <form> <input type="time" name="time" value="09:30" disabled><br> </form>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...