[英]modify input content into a div
<!DOCTYPE html>
<html>
<head>
<title>consultation</title>
<link rel="stylesheet" type="text/css" href="css/consultation.css">
<script type="text/javascript">
var date_1;
//setInterval( functionDate() , 999 );
function functionDate()
{
//alert( form_1.length );
date_1 = new Date();
date_1 = date_1.getHours() + ":" + date_1.getMinutes() + ":" + date_1.getSeconds();
form_1.date.value = "";
form_1.date.value = "date_1";
}
</script>
</head>
<body>
<form name="form_1" >
<div id="container">
<div id="header">
<img src="images/picture_1.png" id="image" width="60" height="60">
<p id="select_product_p">
Select product:
</p>
<input list="product" id="select_product">
<datalist id="product" >
<option>Tortilla</option>
<option>Masa</option>
</datalist>
<p id="product_amount_p">
Product amount:
</p>
<input type="number" id="product_amount" min="1">
<p id="unit_price_p">
Unit price:
</p>
<input type="number" id="unit_price" min="1" size="5">
<button type="button" id="add_product">Add Product</button>
<input type="text" name="hour" id="hour_id">
<!--
</div>
<div id="medium">
</div>
<div id="final">
</div>
</div>
-->
</form>
</body>
</html>
im trying to build a clock whit a setInterval and then put the our on input tag but i dont know why is wrong. 即时通讯试图建立一个时钟,一个setInterval然后把我们的输入标签,但我不知道为什么错了。 i know that i can change the value on tag.
我知道我可以更改标签上的值。 thinking maybe i can use a .innerHTML.
想也许我可以使用.innerHTML。 thank you.
谢谢。
I'm not sure if I get what you want to achieve, but to set time to your input field, you can do this: 我不确定是否能达到您想要的目标,但是可以在输入字段中设置时间,您可以这样做:
var nowDate = new Date();
var timeString = nowDate.getHours() + ":" + nowDate.getMinutes() + ":" + nowDate.getSeconds();
document.getElementById("hour_id").value = timeString;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.