Steve meinte:
> On Nov 20, 10:59 pm, Gregor Kofler <use...@gregorkofler.at> wrote:
>> (The rest of the code is ..er... could be better.)
>
> It is obvious that I am self-learned, mainly from this forum and the
> Oreilly Rhino book. So I would be grateful if you could give a little
> more detail of how the code could be improved, or how you would have
> written the code, in order that I can improve my javascript abilities.
Not tested:
function roll() {
var rows = 2, cols = 5, sum, v, c, r,
table = getElementsByTagName("table")[0];
for(c = cols; c--

{
sum = 0;
for(r = rows; r--

{
v = Math.ceil(Math.random()*6);
sum += v;
// innerHTML is not standardized
table.rows[r].cells[c].innerHTML = v;
}
table.rows[rows].cells[c].innerHTML = sum;
}
}
Gregor