topical media & game development

talk show tell print

lib-js-tool-man-examples-common-grid.js / js



  /* Copyright (c) 2005 Tim Taylor Consulting (see LICENSE.txt) */
  
  function Grid(spacing, length) {
          this.spacing = spacing;
          this.length = length;
  }
  
  Grid.prototype.write = function() {
          var html = '';
          for (var i = 1; i <= (this.length / this.spacing); i++) {
                  var num = i * this.spacing;
                  html += '<span class="verticalgridline" style="left: ' + num + 'px;height: ' + this.length + 'px">' + num + '</span>';
                  html += '<span class="horizontalgridline" style="top: ' + num + 'px;width: ' + this.length + 'px">' + num + '</span>';
          }
          document.write(html);
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.