Link to home
Start Free TrialLog in
Avatar of jay_eire
jay_eireFlag for United States of America

asked on

Randomize Images Location

Hi Guys,
I have table on a web page that is displaying 7 different images, what I need to do is to somehow randomize the position of where each image is displayed within the table each time the page loads so that there is not one preference.
I need the 7 images to appear on the page at all times, I've had a scout around the web for a script but haven't found one that displays the 7 seven images each time.

here's my code so far.......

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Randomize Images Location</title>
<style type="text/css">
<!--
.style1 {
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size: 12px;
      font-weight: bold;
}
-->
</style>
</head>

<body>
<p class="style1">Randomize Images Location</p>
<table width="600" border="1">
  <tr>
    <th scope="col"><a href="http://www.google.com"><img src="Image1.jpg" width="120" height="92" border="0" /></a></th>
    <th scope="col"><a href="http://images.google.com/imghp?hl=en&tab=wi"><img src="Image2.jpg" width="120" height="92" border="0" /></a></th>
    <th scope="col"><a href="http://video.google.com/?hl=en&tab=iv"><img src="Image3.jpg" width="120" height="92" border="0" /></a></th>
    <th scope="col"><a href="http://news.google.com/nwshp?tab=vn&hl=en"><img src="Image4.jpg" width="120" height="92" border="0" /></a></th>
    <th scope="col"><a href="http://maps.google.com/maps?tab=nl&hl=en"><img src="Image5.jpg" width="120" height="92" border="0" /></a></th>
    <th scope="col"><a href="http://mail.google.com/mail/?tab=lm"><img src="Image6.jpg" width="120" height="92" border="0" /></a></th>
    <th scope="col"><img src="Image7.jpg" width="120" height="92" /></th>
  </tr>
</table>
<p>&nbsp; </p>
</body>

</html>

 

Ive found this script but its not entirely working as some images end up repeating themselves.
http://www.re-vision.com/webwork/22_javascript/random-images/randomreload.html

Thanks
Jay Eire
ASKER CERTIFIED SOLUTION
Avatar of basicinstinct
basicinstinct
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jay_eire

ASKER

Excellent thanks basicinstinct works a charm.