stormsearchers Posted August 11, 2016 Share Posted August 11, 2016 Hello i am starting to work things out using html and java what i would like to do is put the weather in to a tabele showin down below i think i have ball the code up comesome please help me many thank <html> <head> <meta charset="UTF-8"> <meta name="description" content="Free Weather Rersorce"> <meta name="keywords" content="Weather Forecast,Charts,Blog,Weather Group"> <meta name="author" content="Michael Wright"> <title>StormSearchers</title> <link ref="stylesheet" type="text/css" href="mystyle.css" /> <script type="text/javascript" src="weather.js"></script> </head> <body> <div class="weather"> <table> <tr> <th>City</th> <th>Winds</th> <th>humidity</th> <th>pressure</th> <th>Rain</th> <th>Forecast</th> </tr> <tr> <td><div class="location"><span id="location">Unknow</span></div></td> <td><div class="winds"<span id="Winds">0</span> Km/h<span id="direction">N</span></td> <td><div class="humidity"><img="imgs/humidity.png" height="16px"<span id="humidity">0</span>%</td> <td><div class="pressure"<span id="HPA">0000</span></td> <td><div class="rain"<span id="Rain">00</span> mm <span id="direction">N</span></td> <td><div class="Forecast"<span id="Forecast"><img id="icon" width="75px" src="imgs/codes/200.png"</span></td> </tr> <div> </body> <html> Link to comment Share on other sites More sharing options...
dsonesuk Posted August 11, 2016 Share Posted August 11, 2016 (edited) You need matching number closing tags with matching number of opening tags, any opening tags within td element MUST finish with a closing closing tag within same td element. You are also not closing opening tags correctly <div class="whatever">...</div> Most tags opening/closing tags start with '<' and finish with '>' with most closing tag starting with '</', the exception to this are elements such as img, or input element which are void elements <img src="whatever.jpg" alt="" > (although xhtml do self close with <img src="whatever.jpg" alt="" />), meaning they cannot hold content like a div, paragraph element can Edited August 11, 2016 by dsonesuk Link to comment Share on other sites More sharing options...
stormsearchers Posted August 11, 2016 Author Share Posted August 11, 2016 Ok Also when var temp; var loc; var icon; var humidity; var winds; var direction; function updateByPostcode(postcode){ var url = "http://api.openweathermap.org/data/2.5/weather?" + "postcode = " + postcode + "&APPID=" +APPID sendRequest(url): } function sendRequest(url){ var xmlhttp = new XMLHttpRequest(); xml.http.onreadystatechange = function(){ if (xmlhttp.readystate == 4 && xmlhttp.status == 200) var data = JSON.parse(xml.ResponseText); var weather = {}; weather.icons = data.weather[0].id; weather.humidity = data.main.humidity; weather.wind = data.wind.speed; weather.direction = data.wind.deg; weather.loc = data.name; weather.temp = data.main.temp; update(weather); } }; xmlhttp.open("GET" , url, true); xmlhttp.send(); } function K2C(K){ return Math.round(k - 273.15); } function update(weather){ wind.innerHTML = weather.wind; direction.innerHTML = weather.direction; humidity.innerHTML = weather.humidity; loc.innerHTML weather.loc; temp.innerHTML = weather.temp; icon.src = "imgs/codes/" + weather.icon + ".png"; console.log(icon.src); } windows.onload = functon (){ temp = document.getElementById("temperature"); loc = document.getElementById("Location"); icons = document.getElementById("icons"); humidity = document.getElementById("humidity"); winds = document.getElementById("directions"); pressure = document.getElementById("hpa"); var weather ={}; weather.winds = 3.5; weather.direction = "N"; weather.humidity = 35; weather.loc = "Townsville"; weather.temp = "45"; weather.icon = 200; updateByPostcode(4810); } you look at my site http://stormsearchers.site88.net my code dose not want to work all upday the JS file Link to comment Share on other sites More sharing options...
dsonesuk Posted August 11, 2016 Share Posted August 11, 2016 No such thing as 'windows.onload' it should be window.onload' Link to comment Share on other sites More sharing options...
johnniewalk Posted September 22, 2016 Share Posted September 22, 2016 Looking this type of code it makes me a lot of confusions, i don't know how the web developer and designers remember those codes for me its a strange.. Link to comment Share on other sites More sharing options...
stormsearchers Posted October 9, 2016 Author Share Posted October 9, 2016 I have fixed it all up now I have to do is the css table part and thankyou for the help Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now