<!DOCTYPE html>
<html>
<head>
<title>test on iphone</title>
<script>
var Test = (function() {
function Test() {
this.counter = 0;
this.value = 1;
}
Test.prototype.Add = function() {
this.counter += this.value;
};
Test.prototype.Flip = function() {
this.value *= -1;
};
Test.prototype.Go = function(scope) {
var body = document.getElementsByTagName("h1")[0];
body.innerHTML = scope.counter;
scope.Add();
if (scope.counter == 10)
scope.Flip();
else if (scope.counter==0)
scope.Flip();
setTimeout(scope.Go, 1000, scope);
};
return Test;
})();
</script>
<style type="text/css">
h1 { text-align: center; font-size: 72pt; }
</style>
</head>
<body>
<h1>hello. world!</h1>
<script>
var t = new Test();
t.Go(t);
</script>
</body>
</html>
Comments