Reputation: 19
I have been banging my head over this (probably simple) issue and am missing something really basic. Why does this first code display the expected output
xmlhttp=xmlhttp.responseXML;
document.getElementById("CenterDataBox").innerHTML= xmlhttp.getElementsByTagName("ShowDay")[0].childNodes[0].nodeValue;
and this second one doesn't? I think this is something really simple I've overlooking.
xmlhttp=xmlhttp.responseXML;
var DayOfShow = xmlhttp.getElementsByTagName("ShowDay")[0].childNodes[0].nodeValue;
document.getElementById("CenterDataBox").innerHTML= DayofShow;
Upvotes: 0
Views: 68
Reputation: 736
The error is that your variable DayOfShow is not what you're using. You're using DayofShow, without capital '0' letter.
Upvotes: 1
Reputation: 163
You got mispelling of set variable. In example 2 i assume you're getting error var not defined. That is because you set value to DayOfShow and below you set inner html to DayofShow. Javascript is case sensitive.
Here you can read more about JS.
Upvotes: 0
Reputation: 10627
JavaScript is case-sensitive.
= DayofShow
should be = DayOfShow
in example 2.
Upvotes: 1