rename status variable to statusElem, so it doesnt conflict with window.status
This commit is contained in:
parent
1841e4ac64
commit
30cbdcd75b
|
@ -4,10 +4,10 @@
|
|||
<p>A timer is constantly polling the navigator.onLine property, which is typically switched via File -> Work Offline</p>
|
||||
</article>
|
||||
<script>
|
||||
var status = document.getElementById('status')
|
||||
var statusElem = document.getElementById('status')
|
||||
|
||||
setInterval(function () {
|
||||
status.className = navigator.onLine ? 'online' : 'offline';
|
||||
status.innerHTML = navigator.onLine ? 'online' : 'offline';
|
||||
statusElem.className = navigator.onLine ? 'online' : 'offline';
|
||||
statusElem.innerHTML = navigator.onLine ? 'online' : 'offline';
|
||||
}, 250);
|
||||
</script>
|
|
@ -4,12 +4,12 @@
|
|||
<ol id="state"></ol>
|
||||
</article>
|
||||
<script>
|
||||
var status = document.getElementById('status'),
|
||||
state = document.getElementById('state');
|
||||
var statusElem = document.getElementById('status'),
|
||||
state = document.getElementById('state');
|
||||
|
||||
function online(event) {
|
||||
status.className = navigator.onLine ? 'online' : 'offline';
|
||||
status.innerHTML = navigator.onLine ? 'online' : 'offline';
|
||||
statusElem.className = navigator.onLine ? 'online' : 'offline';
|
||||
statusElem.innerHTML = navigator.onLine ? 'online' : 'offline';
|
||||
state.innerHTML += '<li>New event: ' + event.type + '</li>';
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue