紆余曲折ブログ
ホーム
プロフィール
お問い合わせ
雑記ブログ一覧
技術ブログ一覧
eating 雑記ブログ投稿一覧
この記事カテゴリにはまだ投稿がありません。
※本記事は情報提供を目的としています。投資・購買等の判断はご自身の責任でお願いいたします。
最新のお知らせを見る
jQuery を利用するには、以下のように jQuery.ready() 内のコードを囲む ことを忘れないでください: jQuery(document).ready(function( $ ){ // あなたのコードをここに記述 }); -- 別のサーバー上の JavaScript のファイルへリンクしたいなら ( と同じように) これは、HTML コードなので「HTMLコードの追加」を使ってください。 コメント終わり */ document.addEventListener("DOMContentLoaded", function() { function getDarkModeStatus(time) { return time > 20 ? "dark" : "light"; } const mode = getDarkModeStatus(new Date().getHours()); const darkmodeBox = document.querySelector(".darkmode-box"); if(darkmodeBox){ darkmodeBox.style.backgroundColor = mode === "dark" ? "#000" : "#fff"; darkmodeBox.style.color = mode === "dark" ? "#fff" : "#000"; } function getSeason(month) { if (month >= 3 && month <= 5) return "春"; if (month >= 6 && month <= 8) return "夏"; if (month >= 9 && month <= 11) return "秋"; return "冬"; } const currentMonth = new Date().getMonth() + 1; const season = getSeason(currentMonth); const seasonDisplay = document.getElementById("season-display"); if(seasonDisplay){ seasonDisplay.textContent = `現在の月は ${currentMonth} 月なので、季節は ${season} です!`; } });