473,804 Members | 3,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Rotating content for table cells

I am designing a table with 2 columns and 20 rows. I want to insert
small images (each with a link) and a text title in each cell of the
table.

On refresh of the page, I would like to have the contents of each cell
(picture/link and associated text) rotate randomly.

Note that the text titles must remain with their associated picture
and link (I don't want to scramble all the elements--just rotate the
entire contents of the table cell).

Is there a script that will accomplish this? Thanks.
Jul 23 '05
31 7049
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.
Jul 23 '05 #31
RomanRusso
5 New Member
Hello,
Thank you very much for the script
Would you be able to read my question here, I think you can answer my question within a minute, I personally cannot find an answer
http://www.thescripts.com/forum/thread493388.html
May 21 '06 #32

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
7737
by: Finn Newick | last post by:
By defining a style as follows: @media aural, handheld {td.layout {display:block;}} I'm hoping to linearise layout tables when viewed by screenreaders and handheld devices (it is also be in some selectable user preferences). This works as intended in Netscape 7 - all the cells stack vertically above each other nicely, but not in Internet Explorer 6 where the only display property that td will respond to seems to be 'none'.
8
4420
by: Jukka K. Korpela | last post by:
I just noticed that most browsers render <table border="1"><tr><td><p>foo</p></td></tr></table> the same way as <table border="1"><tr><td>foo</td></tr></table> That is, they ignore the p markup in the sense that they don't apply the normal default top and bottom margins. This is rather odd, especially
1
2646
by: Mark Carroll | last post by:
I can't get my table cells to not have a gap between them in IE. For example, with IE6SP1 I get a gap between the two red squares on http://www.chiark.greenend.org.uk/~markc/test/test.html instead of just seeing one red rectangle. The CSS in that case had width: 1px; margin: 0; padding: 0; border-width: 0; border-spacing: 0 What can I do to get the red squares nestled together in the table with no space in between? -- Mark
4
26211
by: N. Demos | last post by:
The following code renders as intended in IE (A TABLE, with cells of fixed width and height, inside of a DIV with fixed width and height and overflow set to hidden.) In Firefox, the table cells assume a narrower with than specified. If I comment out the width for the DIV, then the cells render with the correct width and height. Why is this happening? Thanks. Regards, N. Demos
0
1689
by: N. Demos | last post by:
I have a single row table with fixed dimensioned cells nested inside a fixed dimensioned div, which has overflow: hidden. The div's dimensions are such that It should only display the first two table cells. This all renders correctly in MSIE 6.x, but doesn't in Firefox. In Firefox, the cell widths are reduced so that all the cells are displayed within the div frame. I've played around with this: commenting out css properties to see if...
3
5914
by: N. Demos | last post by:
I have a single row table with fixed dimensioned cells nested inside a fixed dimensioned div, which has overflow: hidden. The div's dimensions are such that It should only display the first two table cells. This all renders correctly in MSIE 6.x, but doesn't in Firefox. In Firefox, the cell widths are reduced so that all the cells are displayed within the div frame. I've played around with this: commenting out css properties to see if...
5
36881
by: Richard Dixson | last post by:
I created a new C# web application. Basically all I am trying to do is create a table that consists of a few rows with two columns in each. And then to set those columns to text values from my code behind. However I am not able to do this at all, I am going about this wrong, I think and need guideance. If this was just straight HTML I would do this: <table> <tr><td>field 1</td><td>value 1 set by code behind</td></tr>
1
2927
by: RobG | last post by:
I'm trying to get table cells to clip content rather than wrapping. It has been suggested to use: td.clipped { width: 5em; overflow: hidden; white-space: nowrap; }
0
1327
by: JM | last post by:
I'm using VS2005 SP1. It seems to me, when I used VS2003, the IDE would only insert height and width attributes in table cells if you dragged to resize a cell. Now, with VS2005, I get the style attributes whenever I drop a control into a cell or add content, and it's ANNOYING. Does anybody know of a way to get designer to stop slapping style attributes in table cells?
2
3039
by: markszlazak | last post by:
I'm a relatively slow response of table cells changing their background color with mouseover/our in IE6 (Win 2K) but the response is fine (fast) in Firefox. Why? The code is below. Sorry about the length. <html> <head> <title>Rapid Blocking Interface</title> <style> .calendar {
0
10575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3816
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.