0
我嘗試使用comments mark
設置輸入類型的代碼。 我想獲得輸入類型,所以我可以添加一個specific GMT
。如何在html中使用javascript在input =「time」中放置時間
<html>
<head>
<script language="JavaScript">
function calcTime(city, offset) {
d = new Date();
utc = d.getTime() + (d.getTimezoneOffset() * 60000);
nd = new Date(utc + (3600000*offset));
document.write("\n\t\n");
return "<br>"+"The local time in " + city + " is " + nd.toLocaleString()+ "<br>" ;
}
// get Singapore time
//document.write(calcTime('Singapore', '+8'));
//document.getElementById("tim").value = "(calcTime('Singapore', '+8'))";
//document.write("tim").value = (calcTime('Singapore', '+8'));
// get London time
//document.write("tim".value(calcTime('London', '+1')));
// I TRIES THE CODES^BUT IT IS NOT
document.write(calcTime('Moscow', '+3'));
</script>
</head>
<body>
<input type="time" name="tim" id="tim" value ="">
</body>
</html>
我說像這樣 的document.getElementById( 「蒂姆」)值=「22時53分05秒「;但它尚未處於輸入類型 –
請確保在'body'內有此腳本,並且'