0

Javascript で特定の日付に言及する必要がないように、タイマーが毎日 4 分の 1 に設定されていることを確認するにはどうすればよいですか? また、フォームの代わりに div または p で出力を表示するにはどうすればよいですか。

<!DOCTYPE html>

<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>jQuery Countdown</title>
</head>

<body>
<script language="javascript" type="text/javascript">

    function getTime() {
        now = new Date();
        orderBy = new Date("May 17 2016 16:30:00");
        //days = (orderBy - now) / 1000 / 60 / 60 / 24;
        daysRound = Math.floor(days);
        hours = (orderBy - now) / 1000 / 60 / 60 - (24 * daysRound);
        hoursRound = Math.floor(hours);
        minutes = (orderBy - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
        minutesRound = Math.floor(minutes);
        seconds = (orderBy - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
        secondsRound = Math.round(seconds);
        sec = (secondsRound == 1) ? "" : "";
        min = (minutesRound == 1) ? " : " : " : ";
        hr = (hoursRound == 1) ? " : " : " : ";
        //dy = (daysRound == 1)  ? " day" : " days, ";
        document.timeForm.input1.value = "Check again before " + hoursRound + hr + minutesRound + min + secondsRound + sec;
        newtime = window.setTimeout("getTime();", 1000);
    }
    window.onload=getTime;

    if (days = 0){
        days.style.display = "none";
    }
</script>

<form name=timeForm>
    <input type=text name=input1 size=50 border-style="none" style="display: block; border: none; font-size: 14px; font-family: sans-serif">
</form>

</body>
</html>

4

1 に答える 1