Answer the question
In order to leave comments, you need to log in
Can't reach span tag?
Tell me what I'm doing wrong?
<h1>До распродажы осталось <strong id="my_span_tag"></strong></h1>
<SCRIPT language=JavaScript>
var months = ["январь","февраля","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"];
function echo_date( date ) {
echo_date = function(date){
date = new Date( date );
return {
"date" : date,
"month" : months[ date.getMonth() ],
"day_num" : date.getDate()
};
}
return echo_date(date);
};
var primer = echo_date( Date.now()+24*60*60*1000 );
var result = primer.day_num+" "+primer.month;
document.getElementById('my_span_tag').innerHTML = result.getFullYear();
</SCRIPT>
Answer the question
In order to leave comments, you need to log in
Your result variable contains the string primer.day_num+" "+primer.month;
result.getFullYear() throws an error because it cannot get the year from the string "February 22"
I still get the error Failed to load resource: net::ERR_FILE_NOT_FOUND
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question