Posted: Sat Mar 12, 2005 2:49 am Random Image Script Question
http://perkymonkey.com/advice/TEST2.html
I'm trying to get the random image script working for this page but can't seem to make it work.
There is suppose to be an image for what the monkey is saying.
Can anyone help me?
SOUCRE CODE:
Quote: <html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
 background-image: url(http://perkymonkey.com/backgrounds/black.jpg);
 background-color: #000000;
}
.style3 {color: #FFFFFF; font-size: 22px; }
.style4 {font-size: 15px}
.style5 {color: #FFFFFF}
a:link {
 color: #FFFFFF;
 text-decoration: none;
}
a:visited {
 text-decoration: none;
 color: #FFFFFF;
}
a:hover {
 text-decoration: underline;
 color: #FFFFFF;
}
a:active {
 text-decoration: none;
 color: #FFFFFF;
}
-->
</style></head>
Â
<body><script language="JavaScript" type="text/JavaScript">
<script language="JavaScript" type="text/javascript">
// This script was supplied free by Hypergurl
// http://www.hypergurl.com
<!--
  // JavaScript to interpolate random images into a page.
  var ic = 30;   // Number of alternative images
  var xoxo = new Array(ic);  // Array to hold filenames
 Â
xoxo[0] = "/advice/ask/images/advice_images/1.jpg";
xoxo[1] = "/advice/ask/images/advice_images/2.jpg";
xoxo[2] = "/advice/ask/images/advice_images/3.jpg";
xoxo[3] = "/advice/ask/images/advice_images/4.jpg";
xoxo[4] = "/advice/ask/images/advice_images/5.jpg";
xoxo[5] = "/advice/ask/images/advice_images/6.jpg";
xoxo[6] = "/advice/ask/images/advice_images/7.jpg";
xoxo[7] = "/advice/ask/images/advice_images/8.jpg";
xoxo[8] = "/advice/ask/images/advice_images/9.jpg";
xoxo[9] = "/advice/ask/images/advice_images/10.jpg";
xoxo[10] = "/advice/ask/images/advice_images/11.jpg";
xoxo[11] = "/advice/ask/images/advice_images/12.jpg";
xoxo[12] = "/advice/ask/images/advice_images/13.jpg";
xoxo[13] = "/advice/ask/images/advice_images/14.jpg";
xoxo[14] = "/advice/ask/images/advice_images/15.jpg";
xoxo[15] = "/advice/ask/images/advice_images/16.jpg";
xoxo[16] = "/advice/ask/images/advice_images/17.jpg";
xoxo[17] = "/advice/ask/images/advice_images/18.jpg";
xoxo[18] = "/advice/ask/images/advice_images/19.jpg";
xoxo[19] = "/advice/ask/images/advice_images/20.jpg";
xoxo[20] = "/advice/ask/images/advice_images/21.jpg";
xoxo[21] = "/advice/ask/images/advice_images/22.jpg";
xoxo[22] = "/advice/ask/images/advice_images/22.jpg";
xoxo[23] = "/advice/ask/images/advice_images/24.jpg";
xoxo[24] = "/advice/ask/images/advice_images/25.jpg";
xoxo[25] = "/advice/ask/images/advice_images/26.jpg";
xoxo[26] = "/advice/ask/images/advice_images/27.jpg";
xoxo[27] = "/advice/ask/images/advice_images/28.jpg";
xoxo[28] = "/advice/ask/images/advice_images/29.jpg";
xoxo[29] = "/advice/ask/images/advice_images/30.jpg";
Â
function pickRandom(range) {
if (Math.random)
return Math.round(Math.random() * (range-1));
else {
var now = new Date();
return (now.getTime() / 1000) % range;
}
}
// Write out an IMG tag, using a randomly-chosen image name.
var choice = pickRandom(ic);
// -->
</script>
<table width="844" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
  <td width="252" rowspan="4" valign="bottom"><img src="ask/images/fullleft.jpg" width="252" height="591"></td>
  <td width="262" rowspan="2" align="left" valign="bottom"><script>
<SCRIPT LANGUAGE="JavaScript">document.writeln('<TD'+'><IMG SRC="'+xoxo[choice]+'" HEIGHT=174 WIDTH=262 BORDER=0 ><'+'/TD>');</script></td>
  <td width="414" height="99"><div align="center" class="style5"><tt>Ask the perky monkey anything!<br>
 Type in your question and here and he <br>
 will respond with his advice instantly.</tt></div></td>
 </tr>
 <tr>
  <td height="90"><form name="form1" method="post" action="">
 <div align="center">
  <input name="textfield" type="text" size="45">
  <br>
  <input name="Ask Perky" type="submit" id="Ask Perky" value="Ask Perky">
 </div>
  </form></td>
 </tr>
 <tr>
  <td rowspan="2" align="left" valign="bottom"><img src="ask/images/bottomright.jpg" width="262" height="418"></td>
  <td height="326"><div align="center"><span class="style3"><tt>We have  thousands of cagged monkeys constantly being taught english. The most promising monkey thus far has been Perky. As good as he's getting, he still like a small romainian girl. He only can only anwser so many questions and will reply with things that dont make any sense in context. Currently Perky knows 100 sentences and will be taught more very soon! </tt></span></div></td>
 </tr>
 <tr>
  <td><div align="center"><span class="style3"><tt><span class="style4">Do you have a question for our<br>
weekly advice column?<br>
If so, <a href="mailto:adviceatperkymonkey.com"><u>email it here</u></a>. </span></tt></span></div></td>
 </tr>
 <tr>
  <td colspan="3"><img src="ask/askbanner.jpg" width="928" height="89"></td>
 </tr>
</table>
</body>
</html>
degsy
Joined: 23 Feb 2005
Posts: 2440
Location: North East, UK