alert
値(以下を参照)を実行すると、なぜ返されるのnull
ですか?そのIDを持つ要素が存在する場合は?
// make reference to divs
var countdown_timer = document.getElementById("countdown_timer");
var countdown_image = document.getElementById("countdown_image");
// For element manipulation
if (type == 'image') {
var element = countdown_image;
} else if (type == 'timer') {
var element = countdown_timer;
}
alert(countdown_timer);
divは以下のとおりです。
<div class="timer" id="countdown_timer"></div>