Page 1 of 1

Monthly Records Month Selection Broken

Posted: Fri 29 Jan 2016 10:12 pm
by Grimers
Hi Steve,

I would be very grateful if you could have a scan over my problem which is related to my monthly records page. For some reason, I don't know when but when I click any of the months the data does not change? I have checked my code against the distributed code but there's no difference as far as I can tell.

Here is the page: http://www.newton-poppleford-weather.co ... ecords.htm

I have attached the local copy of the page as well.

Thanks in advance.

Re: Monthly Records Month Selection Broken

Posted: Fri 29 Jan 2016 10:51 pm
by beteljuice
You have no element called 'monthname', so everything folds.

Re: Monthly Records Month Selection Broken

Posted: Sat 30 Jan 2016 9:22 am
by Grimers
beteljuice wrote:You have no element called 'monthname', so everything folds.
Exactly what I was thinking, but I haven't changed anything...

EDIT: Aha, so I have changed something! I removed the <span id="MonthName">January</span> code so it broke. A bit strange though.

Re: Monthly Records Month Selection Broken

Posted: Sat 30 Jan 2016 11:21 am
by beteljuice
These parts of the code are unconditional

Code: Select all

function changeData(month) {
	document.getElementById('MonthName').innerHTML = monthnames[month];
	document.getElementById('TempH').innerHTML = hightemp[month];

etc. etc.
i.e. The element MUST exist or else the 'instruction' which follows creates a fatal error.