admin管理员组文章数量:1419583
I'm newbie on java coding.
I have a weather station console (a simple webpage display on Android tablet) which I want to embed a weather forecast into it; and expect it to auto refresh every 1 hour.
The weather forecast code is here:
<a class="weatherwidget-io" href="/" data-label_1="PHRA KHANONG" data-label_2="WEATHER" data-font="Arial Rounded MT Bold" data-icons="Climacons" data-theme="dark" data-textColor="#d7e614" data-highColor="#f59c65" data-lowColor="#09cef1" >PHRA KHANONG WEATHER</a>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=".min.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","weatherwidget-io-js");
I can embed it into my webpage, but I would like it to auto update every 1 hour. Please help.
Thank you
I'm newbie on java coding.
I have a weather station console (a simple webpage display on Android tablet) which I want to embed a weather forecast into it; and expect it to auto refresh every 1 hour.
The weather forecast code is here:
<a class="weatherwidget-io" href="https://forecast7./en/13d69100d61/phra-khanong/" data-label_1="PHRA KHANONG" data-label_2="WEATHER" data-font="Arial Rounded MT Bold" data-icons="Climacons" data-theme="dark" data-textColor="#d7e614" data-highColor="#f59c65" data-lowColor="#09cef1" >PHRA KHANONG WEATHER</a>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://weatherwidget.io/js/widget.min.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","weatherwidget-io-js");
I can embed it into my webpage, but I would like it to auto update every 1 hour. Please help.
Thank you
Share Improve this question edited Jan 6, 2018 at 3:45 bthoven asked Jan 6, 2018 at 2:19 bthovenbthoven 151 silver badge4 bronze badges 1- 4 Please provide code samples and tag your question appropriately. Java and Javascript are 2 different languages. The code samples should be contained within your initial post and not in a ment. – Pyromonk Commented Jan 6, 2018 at 2:21
3 Answers
Reset to default 6Use the following code to refresh the weather widget every hour:
setInterval('__weatherwidget_init()', 3600000)
you can use setInterval(callbackFn, timeinMS) method in javascript to call after some interval.
You can also do it in HTML, this will refresh every 60 seconds:
<meta http-equiv="refresh" content="60">
本文标签: javascriptAuto refresh weather forecast scriptStack Overflow
版权声明:本文标题:javascript - Auto refresh weather forecast script - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745314396a2653082.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论