mirror of
https://github.com/Erreur32/html5demos.git
synced 2024-09-29 00:11:33 +02:00
Merge pull request #16 from paulirish/master
rename status variable to statusElem, so it doesnt conflict with window.status
This commit is contained in:
commit
c6ac81ed92
@ -4,10 +4,10 @@
|
|||||||
<p>A timer is constantly polling the navigator.onLine property, which is typically switched via File -> Work Offline</p>
|
<p>A timer is constantly polling the navigator.onLine property, which is typically switched via File -> Work Offline</p>
|
||||||
</article>
|
</article>
|
||||||
<script>
|
<script>
|
||||||
var status = document.getElementById('status')
|
var statusElem = document.getElementById('status')
|
||||||
|
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
status.className = navigator.onLine ? 'online' : 'offline';
|
statusElem.className = navigator.onLine ? 'online' : 'offline';
|
||||||
status.innerHTML = navigator.onLine ? 'online' : 'offline';
|
statusElem.innerHTML = navigator.onLine ? 'online' : 'offline';
|
||||||
}, 250);
|
}, 250);
|
||||||
</script>
|
</script>
|
@ -4,12 +4,12 @@
|
|||||||
<ol id="state"></ol>
|
<ol id="state"></ol>
|
||||||
</article>
|
</article>
|
||||||
<script>
|
<script>
|
||||||
var status = document.getElementById('status'),
|
var statusElem = document.getElementById('status'),
|
||||||
state = document.getElementById('state');
|
state = document.getElementById('state');
|
||||||
|
|
||||||
function online(event) {
|
function online(event) {
|
||||||
status.className = navigator.onLine ? 'online' : 'offline';
|
statusElem.className = navigator.onLine ? 'online' : 'offline';
|
||||||
status.innerHTML = navigator.onLine ? 'online' : 'offline';
|
statusElem.innerHTML = navigator.onLine ? 'online' : 'offline';
|
||||||
state.innerHTML += '<li>New event: ' + event.type + '</li>';
|
state.innerHTML += '<li>New event: ' + event.type + '</li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user