Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying a random item of an XML file in an HTML page

Status
Not open for further replies.

Stretchwickster

Programmer
Joined
Apr 30, 2001
Messages
1,746
Location
GB
Hi,

I've got an XML file which I am calling from an HTML page and it shows one item of the XML file at a time. I have controls to move forwards and backwards through the XML recordset. What I want to be able to do is randomly display a record each time the HTML page is opened/refreshed. Can anyone give me a clue as to how I can achieve this?

My current code is as follows:
Code:
<XML ID="Quotes" SRC="Quotes.xml"> </XML>
<TABLE ALIGN=center CELLPADDING="5" BORDER="0">
 <TR>
  <TD> <IMG SRC="PreviousButton.jpg" OnClick="Quotes.recordset.MovePrevious();
	  	if(Quotes.recordset.BOF)
        	  	Quotes.recordset.MoveNext()"> </TD>
  <TD> 
   <TABLE> 
    <TR><TD><B><SPAN DATASRC="#Quotes" DATAFLD="TEXT"></SPAN></B></TD></TR>
    <TR><TD></TD></TR>
    <TR><TD><B><SPAN DATASRC="#Quotes" DATAFLD="PASSAGE"></SPAN></B></TD></TR>
   </TABLE>
  </TD>
  <TD> <IMG SRC="NextButton.jpg" OnClick="Quotes.recordset.MoveNext();
	 	if(Quotes.recordset.EOF)
    			Quotes.recordset.MovePrevious()"> </TD>
 </TR>
</TABLE>

Clive [infinity]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer."
Paul Ehrlich
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top