Re: html table dynamic dimensions that track a for loop



JRS: In article <1132222503.593938.87260@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
dated Thu, 17 Nov 2005 02:15:03, seen in news:comp.lang.javascript,
murrayatuptowngallery <murrayatuptowngallery@xxxxxxxxx> posted :
>
><script type="text/javascript">
> var AAA = new Array(4)
>
>AAA[0] = 2*0.1*Math.round(10*Math.log(32)/Math.log(2))
>AAA[1] = 2*0.1*Math.round(10*Math.log(16)/Math.log(2))
>AAA[2] = 2*0.1*Math.round(10*Math.log(8)/Math.log(2))
>AAA[3] = 2*0.1*Math.round(10*Math.log(5.656)/Math.log(2))
>
>
>theTable='<table border="5"><tr><td>';
>theTable+=AAA[0];
>theTable+='</td><td>';
>theTable+=AAA[1];
>theTable+='</td></tr><tr><td>';
>theTable+=AAA[2];
>theTable+='</td><td>';
>theTable+=AAA[3];
>theTable+='</td></tr></table>';
>document.write(theTable);
>
></script>


Consider :

<script type="text/javascript">

function AAA(K) { return 2*0.1*Math.round(10*Math.log(K)/Math.log(2)) }

var AA = [[32, 16], [8, 5.656, 1.414]]

T = '<table border="5"><tr><td>';
for (J=0 ; J<AA.length; J++) { AAJ = AA[J]
T += "<tr>"
for (K=0 ; K<AAJ.length ; K++)
T += "<td>" + "AAA(" + AAJ[K] + ") = " + AAA(AAJ[K]) + "<\/td>"
T += "<\/tr>" }
T += '<\/table>';
document.write(T);

</script>

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
.



Relevant Pages

  • Re: explain what this means
    ... function getObj{var T ... jscr maths, dates, sources. ... TP/BP/Delphi/jscr/&c, FAQ items, links. ... Prev by Date: ...
    (comp.lang.javascript)
  • Re: Confused on Syntax
    ... What I would use is the parseInt function: ... Unary + will do what is wanted, and FWIW will do it quicker. ... jscr maths, dates, sources. ...
    (microsoft.public.scripting.jscript)
  • Re: Script in iframe unintentionally halting script in parent
    ... var cur=Math.round) ... Don't let your posting agent line-wrap your code. ... jscr maths, dates, sources. ... TP/BP/Delphi/jscr/&c, FAQ items, links. ...
    (comp.lang.javascript)

Loading