Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I recommend another Format method. the John Resig micro-template is a very good and simple tool for do what you need. (<a href="http://ejohn.org/blog/javascript-micro-templating/" rel="noreferrer">ejohn microtemplating</a>)</p> <pre><code>(function(){ var cache = {}; this.tmpl = function tmpl(str, data){ // Figure out if we're getting a template, or if we need to // load the template - and be sure to cache the result. var fn = !/\W/.test(str) ? cache[str] = cache[str] || tmpl(document.getElementById(str).innerHTML) : // Generate a reusable function that will serve as a template // generator (and which will be cached). new Function("obj", "var p=[],print=function(){p.push.apply(p,arguments);};" + // Introduce the data as local variables using with(){} "with(obj){p.push('" + // Convert the template into pure JavaScript str.replace(/[\r\t\n]/g, " ") .split("{{").join("\t") .replace(/((^|}})[^\t]*)'/g, "$1\r") .replace(/\t=(.*?)}}/g, "',$1,'") .split("\t").join("');") .split("}}").join("p.push('") .split("\r").join("\\'") + "');}return p.join('');"); // Provide some basic currying to the user return data ? fn( data ) : fn; }; })(); </code></pre> <p>It is very simple to use. This allows not only show variables between HTML but also execute JavaScript code</p> <p>Your template string need some modification to work with this microtemplate.</p> <pre><code>{{for(var i=0; i&lt;tables.length;i++){ }} &lt;table&gt; {{=tables[i]}} &lt;/table&gt; {{ } }} </code></pre> <p>finally only need to select all the tables that appear in your example</p> <pre><code>document.getElementsByTagName("table"); </code></pre> <p>you can see how it works <a href="http://jsfiddle.net/Scipion/P8rpn/1/" rel="noreferrer">http://jsfiddle.net/Scipion/P8rpn/1/</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload