diff options
author | Scott Ullrich <sullrich@sullrich-MacBookPro.local> | 2009-03-08 18:10:04 -0400 |
---|---|---|
committer | Scott Ullrich <sullrich@sullrich-MacBookPro.local> | 2009-03-08 18:10:04 -0400 |
commit | 5f00df88bdbc32a6843be5b5810059af9081d957 (patch) | |
tree | 5fb7f55ba016ec53a5bae5f453b337123bd1bb4d | |
parent | 7a2154f63719495879401ee55e80f8f4e11ef480 (diff) | |
download | pfsense-5f00df88bdbc32a6843be5b5810059af9081d957.zip pfsense-5f00df88bdbc32a6843be5b5810059af9081d957.tar.gz |
Test to make sure items exist before trying to get their properties
-rw-r--r-- | usr/local/www/javascript/index/sajax.js | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/usr/local/www/javascript/index/sajax.js b/usr/local/www/javascript/index/sajax.js index 36bd7ca..edf3b4d 100644 --- a/usr/local/www/javascript/index/sajax.js +++ b/usr/local/www/javascript/index/sajax.js @@ -32,18 +32,22 @@ function stats(x) { function updateMemory(x) { - document.getElementById("memusagemeter").value = x + '%'; - - document.getElementById("memwidtha").style.width = x + 'px'; - document.getElementById("memwidthb").style.width = (100 - x) + 'px'; + if($('memusagemeter')) + document.getElementById("memusagemeter").value = x + '%'; + if($('memwidtha')) + document.getElementById("memwidtha").style.width = x + 'px'; + if($('memwidthb')) + document.getElementById("memwidthb").style.width = (100 - x) + 'px'; } function updateCPU(x) { - document.getElementById("cpumeter").value = x + '%'; - - document.getElementById("cpuwidtha").style.width = x + 'px'; - document.getElementById("cpuwidthb").style.width = (100 - x) + 'px'; + if($('cpumeter')) + document.getElementById("cpumeter").value = x + '%'; + if($('cpuwidtha')) + document.getElementById("cpuwidtha").style.width = x + 'px'; + if($('cpuwidthb')) + document.getElementById("cpuwidthb").style.width = (100 - x) + 'px'; } function updateTemp(x) @@ -65,12 +69,14 @@ function updateDateTime(x) { function updateUptime(x) { - document.getElementById("uptime").value = x; + if($('uptime')) + document.getElementById("uptime").value = x; } function updateState(x) { - document.getElementById("pfstate").value = x; + if($('pfstate')) + document.getElementById("pfstate").value = x; } function updateInterfaceStats(x){ |