JRS: In article <4e************ **************@ posting.google. com>,
dated Fri, 3 Dec 2004 00:44:05, seen in news:comp.lang. javascript, Royal
Denning <ro***********@ hotmail.com> posted :
I am not only a native speaker of English, I've been paid
to write it professionally for most of my adult life.
;-( So have most of those who write for the public media. The second
part of that paragraph proves nothing.
But I wouldn't mind reiterating what I was looking for originally.
What I was hoping for was a Javascript that would populate the cells
of an HTML table with images and text (and relative hyperlinks to
other pages on the site) from a folder on the website I'm working on.
Upon refreshing the page, the contents of the cells would shuffle
randomly. For a visual example of the shuffling process, see
http://www.topsearchspot.com/rotate10.htm.
Shuffling randomly is not rotating. Those of us who use off-line
newsreaders generally do not want to access the on-line Web to
understand a question that could have been fully explained in News.
... given my limited knowledge
of Javascript, maybe it would be better to ask for a script that
populates the cells of a pre-built html table.
That's not difficult; but it seems not worthwhile unless the table is to
be changed whilst it is being displayed.
If I was briedDr John Stockton <sp**@merlyn.de mon.co.uk> wrote in message
news:<LP****** ********@merlyn .demon.co.uk>.. . JRS: In article <4e************ *************@p osting.google.c om>, dated
Sat, 27 Nov 2004 13:25:51, seen in news:comp.lang. javascript, Royal
Denning <ro***********@ hotmail.com> posted :
Read the newsgroup FAQ - responses should go after trimmed quotes,
interleaved if addressing more than one point. That is the standard
Usenet recommendation.
You will also find in the FAQ an entry on Dealing and Shuffling
Aside: <FAQENTRY> That is not found by a search for "Shuffle" - I
suggest changing to "How to Deal and Shuffle" </FAQENTRY>
linking to
http://www.merlyn.demon.co.uk/js-randm.htm - what you need is
a Deal of the numbers which refer to what goes in the cells.
The following will write such a Table; you will need to enhance the
function Put that generates the full content of a cell from its number,
q.
Note the use of a "standard" function for each "standard" task - Randum
& Deal - and for detail which is best moved out of its surroundings
(Put, Tabel) for clarity.
Note the use of function parameters, e.g. in Tabel.
function Randum(N) { return (N*(Math.random ()%1))|0 }
function Deal(N) { var J, K, Q = new Array(N)
for (J=0; J<N; J++) { K = Randum(J+1) ; Q[J] = Q[K] ; Q[K] = J }
return Q }
function Put(q) { return "Thing<br>Numbe r<br>" + q }
function Tabel(Rows, Cols) { var A = Deal(Rows*Cols) , K=0, C, R
document.writel n("<table border=1>")
for (R=0;R<Rows;R++ ) { document.writel n("<tr>")
for (C=0;C<Cols;C++ ) document.writel n("<td>", Put(A[K++]), "<\/td>")
document.writel n("<\/tr>") }
document.writel n("<\/table>") }
Tabel(3, 5)
Tested in <URL:http://www.merlyn.demo n.co.uk/js-quick.htm>.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.