5
Contributors
6
Replies
10
Views
11 Years
Discussion Span
Last Post by peter_budo
0

Hi, just put two scripts together and managed to get a picture being a link and text to appea, but the text does not coinside with the image and the link.

I wan tthe specific text to apear with the corresponding image and link.

<script language="JavaScript">
<!-- Hide from old browsers

var imagenumber = 9 ;
var randomnumber = Math.random() ;
var rand1 = Math.round( (imagenumber-1) * randomnumber) + 1 ;
images = new Array
images[1] = "tc.gif"
images[2] = "airtours.gif"
images[3] = "clubmed.gif"
images[4] = "firstchoice.gif"
images[5] = "thefirstresort.gif"
images[6] = "JMC.gif"
images[7] = "thomson.gif"
images[8] = "nextag.gif"
images[9] = "portlanddirect.gif"
var image = images[rand1]


links = new Array
links[1] = "http://www.thomascook.co.uk"
links[2] = "http://www.airtours.co.uk"
links[3] = "http://www.clubmed.co.uk"
links[4] = "http://www.firstchoice.co.uk"
links[5] = "http://www.thefirstresort.co.uk"
links[6] = "http://www.jmc.co.uk"
links[7] = "http://www.thomson.co.uk"
links[8] = "http://www.nextag.co.uk"
links[9] = "http://www.portlanddirect.co.uk"
var link = links[rand1]

var Quotation=new Array() 


Quotation[1] = "tomascook";
Quotation[2] = "airtours.";
Quotation[3] = "clubmed.";
Quotation[4] = "firstchoice.";
Quotation[5] = "thefirstresort.";
Quotation[6] = "jmc.";
Quotation[7] = "thomson.";
Quotation[8] = "nextag.";
Quotation[9] = "portlanddirect.";


var Q = Quotation.length;
var whichQuotation=Math.round(Math.random()*(Q-1));
function showQuotation(){document.write(Quotation[whichQuotation]);}
showQuotation();



document.write('<A HREF="' + link + '"><IMG SRC="' + image + '" border="0"></a>')

</script>
0

Ho

I will use this script. Can a set this in the link ... target="_blank" ....

To open the link in a new window ???

Thanks / Danny

0

I know this thread is like forever old but I took the script and put the image and text into a table, switched the image to show on the left and the text is aligned to the top of the image. Pretty nifty :D

<table width="100%" border="0" cellspacing="1" cellpadding="1">
  <tr>
    <td width="2%">
<script language="JavaScript">
<!-- Hide from old browsers

var imagenumber = 9 ;
var randomnumber = Math.random() ;
var rand1 = Math.round( (imagenumber-1) * randomnumber) + 1 ;


images = new Array
images[1] = "../image/day.gif"
images[2] = "../image/day.gif"
images[3] = "../image/day.gif"
images[4] = "../image/day.gif"
images[5] = "../image/day.gif"
images[6] = "../image/day.gif"
images[7] = "../image/day.gif"
images[8] = "../image/day.gif"
images[9] = "../image/day.gif"
var image = images[rand1]


links = new Array
links[1] = "http://www.thomascook.co.uk"
links[2] = "http://www.airtours.co.uk"
links[3] = "http://www.clubmed.co.uk"
links[4] = "http://www.firstchoice.co.uk"
links[5] = "http://www.thefirstresort.co.uk"
links[6] = "http://www.jmc.co.uk"
links[7] = "http://www.thomson.co.uk"
links[8] = "http://www.nextag.co.uk"
links[9] = "http://www.portlanddirect.co.uk"
var link = links[rand1]

var Quotation=new Array() 


Quotation[1] = "tomascook";
Quotation[2] = "airtours.";
Quotation[3] = "clubmed.";
Quotation[4] = "firstchoice.";
Quotation[5] = "thefirstresort.";
Quotation[6] = "jmc.";
Quotation[7] = "thomson.";
Quotation[8] = "nextag.";
Quotation[9] = "portlanddirect.";

document.write('<A HREF="' + link + '"><IMG SRC="' + image + '" border="0"></a>')</script></td>
   
   
   
    <td valign="top" width="98%"><font face="Arial, Helvetica, sans-serif" size="1" color="#000000"> 
      <script language="JavaScript">var Q = Quotation.length;
var whichQuotation=Math.round(Math.random()*(Q-1));
function showQuotation(){document.write(Quotation[whichQuotation]);}
showQuotation();</script></font> 
</td>
  </tr>
</table>
0

I know this thread is like forever old but I took the script and put the image and text into a table, switched the image to show on the left and the text is aligned to the top of the image. Pretty nifty :)

<table width="100%" border="0" cellspacing="1" cellpadding="1">
  <tr>
    <td width="2%">
<script language="JavaScript">
<!-- Hide from old browsers

var imagenumber = 9 ;
var randomnumber = Math.random() ;
var rand1 = Math.round( (imagenumber-1) * randomnumber) + 1 ;


images = new Array
images[1] = "../image/day.gif"
images[2] = "../image/day.gif"
images[3] = "../image/day.gif"
images[4] = "../image/day.gif"
images[5] = "../image/day.gif"
images[6] = "../image/day.gif"
images[7] = "../image/day.gif"
images[8] = "../image/day.gif"
images[9] = "../image/day.gif"
var image = images[rand1]


links = new Array
links[1] = "http://www.thomascook.co.uk"
links[2] = "http://www.airtours.co.uk"
links[3] = "http://www.clubmed.co.uk"
links[4] = "http://www.firstchoice.co.uk"
links[5] = "http://www.thefirstresort.co.uk"
links[6] = "http://www.jmc.co.uk"
links[7] = "http://www.thomson.co.uk"
links[8] = "http://www.nextag.co.uk"
links[9] = "http://www.portlanddirect.co.uk"
var link = links[rand1]

var Quotation=new Array() 


Quotation[1] = "tomascook";
Quotation[2] = "airtours.";
Quotation[3] = "clubmed.";
Quotation[4] = "firstchoice.";
Quotation[5] = "thefirstresort.";
Quotation[6] = "jmc.";
Quotation[7] = "thomson.";
Quotation[8] = "nextag.";
Quotation[9] = "portlanddirect.";

document.write('<A HREF="' + link + '"><IMG SRC="' + image + '" border="0"></a>')</script></td>
   
   
   
    <td valign="top" width="98%"><font face="Arial, Helvetica, sans-serif" size="1" color="#000000"> 
      <script language="JavaScript">var Q = Quotation.length;
var whichQuotation=Math.round(Math.random()*(Q-1));
function showQuotation(){document.write(Quotation[whichQuotation]);}
showQuotation();</script></font> 
</td>
  </tr>
</table>
0

That's pretty slick.

Does anyone know how to make the links open in a new window?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.