« TeamExtreme iteration2 review by Chidambaram | Main | Response to Rosie »

Response to Rosie's blog - a little javascript help

Rosie,
I read your blog post about the javvascript error. I don't have Firefox in the PC I am currently using, so I could not look at the error. But, syntax of the for loop (given below) that you have.....is not quite right. And there are many other syntax errors too. You are trying to concatenate the for loop to the string created previously. which is incorrect.

document.getElementById("response").innerHTML = "" + forecasts[0].getAttribute('type') +"Forecast for " + city[0].childNodes[0].nodeValue + ", " + state[0].childNodes[0].nodeValue + " " + zip[0].childNodes[0].nodeValue + "
retrieved " + forecasts[0].getAttribute('date') + "

" + (RIGHT HERE - THIS SHOULD BE A SEPARATE STATEMENT) for(i=0;i" + prediction[i].childNodes[0].nodeValue + "
" + highTemp[i].childNodes[0].nodeValue + +" " + highTemp[i].getAttribute('units') + "
" + lowTemp[i].childNodes[0].nodeValue + +" " + lowTemp[i].getAttribute('units') + "
" + } + "
End of Forecast.");

Try this instead, (please compare this and see whats different).....(small portion of the code on the right side is missing, but you get the point anyway !! ...I could'nt include the code inside the blog due to javascript restrictions)

code.JPG

Archives

Recent Comments