[OpenLayers-Commits] r11190 - sandbox/cmoullet/openlayers/examples

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Mon Feb 21 10:12:33 EST 2011


Author: cmoullet
Date: 2011-02-21 07:12:33 -0800 (Mon, 21 Feb 2011)
New Revision: 11190

Modified:
   sandbox/cmoullet/openlayers/examples/accelerometer.html
Log:
Fix endless alerts...

Modified: sandbox/cmoullet/openlayers/examples/accelerometer.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/accelerometer.html	2011-02-21 15:07:55 UTC (rev 11189)
+++ sandbox/cmoullet/openlayers/examples/accelerometer.html	2011-02-21 15:12:33 UTC (rev 11190)
@@ -14,41 +14,37 @@
         }
     </style>
     <script type="text/javascript">
-        var result;
         function init() {
-            result = document.getElementById('result');
+            document.getElementById('result');
             if (isEventSupported('deviceorientation', window) || isEventSupported('mozorientation', window) || isEventSupported('devicemotion', window)) {
                 if (window.DeviceOrientationEvent) {
                     alert("window.DeviceOrientationEvent supported");
                     window.addEventListener("deviceorientation", function () {
-                        alert('DeviceOrientationEvent');
-                        result.innerHTML = "Alpha: " + event.alpha;
-                        result.innerHTML = result.innerHTML + "Beta: " + event.beta;
-                        result.innerHTML = result.innerHTML + "Gamma: " + event.gamma;
+                        document.getElementById('result').innerHTML = "Alpha: " + event.alpha;
+                        document.getElementById('result').innerHTML = document.getElementById('result').innerHTML + "Beta: " + event.beta;
+                        document.getElementById('result').innerHTML = document.getElementById('result').innerHTML + "Gamma: " + event.gamma;
                     }, true);
                 }
                 if (window.DeviceMotionEvent) {
                     alert("window.DeviceMotionEvent supported");
                     window.addEventListener('devicemotion', function () {
-                        alert('DeviceMotionEvent');
-                        result.innerHTML = "acceleration.x: " + event.acceleration.x;
-                        result.innerHTML = result.innerHTML + "acceleration.y: " + event.acceleration.y;
-                        result.innerHTML = result.innerHTML + "acceleration.z: " + event.acceleration.z;
-                        result.innerHTML = result.innerHTML + "accelerationIncludingGravity.x: " + event.accelerationIncludingGravity.x;
-                        result.innerHTML = result.innerHTML + "accelerationIncludingGravity.y: " + event.accelerationIncludingGravity.y;
-                        result.innerHTML = result.innerHTML + "accelerationIncludingGravity.z: " + event.accelerationIncludingGravity.z;
-                        result.innerHTML = result.innerHTML + "rotationRate.alpha: " + event.rotationRate.alpha;
-                        result.innerHTML = result.innerHTML + "rotationRate.beta: " + event.rotationRate.beta;
-                        result.innerHTML = result.innerHTML + "rotationRate.gamm: " + event.rotationRate.gamma;
+                        document.getElementById('result').innerHTML = "acceleration.x: " + event.acceleration.x;
+                        document.getElementById('result').innerHTML = document.getElementById('result').innerHTML + "acceleration.y: " + event.acceleration.y;
+                        document.getElementById('result').innerHTML = document.getElementById('result').innerHTML + "acceleration.z: " + event.acceleration.z;
+                        document.getElementById('result').innerHTML = document.getElementById('result').innerHTML + "accelerationIncludingGravity.x: " + event.accelerationIncludingGravity.x;
+                        document.getElementById('result').innerHTML = document.getElementById('result').innerHTML + "accelerationIncludingGravity.y: " + event.accelerationIncludingGravity.y;
+                        document.getElementById('result').innerHTML = document.getElementById('result').innerHTML + "accelerationIncludingGravity.z: " + event.accelerationIncludingGravity.z;
+                        document.getElementById('result').innerHTML = document.getElementById('result').innerHTML + "rotationRate.alpha: " + event.rotationRate.alpha;
+                        document.getElementById('result').innerHTML = document.getElementById('result').innerHTML + "rotationRate.beta: " + event.rotationRate.beta;
+                        document.getElementById('result').innerHTML = document.getElementById('result').innerHTML + "rotationRate.gamm: " + event.rotationRate.gamma;
                     }, true);
                 }
                 if (window.MozOrientation) {
                     alert("window.MozOrientation supported");
                     window.addEventListener("MozOrientation", function () {
-                        alert('MozOrientation');
-                        result.innerHTML = "orientation.x: " + orientation.x;
-                        result.innerHTML = result.innerHTML + "orientation.y: " + orientation.y;
-                        result.innerHTML = result.innerHTML + "orientation.z: " + orientation.z;
+                        document.getElementById('result').innerHTML = "orientation.x: " + orientation.x;
+                        document.getElementById('result').innerHTML = document.getElementById('result').innerHTML + "orientation.y: " + orientation.y;
+                        document.getElementById('result').innerHTML = document.getElementById('result').innerHTML + "orientation.z: " + orientation.z;
                     }, true);
                 }
             } else {



More information about the Commits mailing list