©
©®
I am using a script to generate a random picture on a friend's personal
website. It changes whenever refreshed.
Below the picture, you will see text. At the moment the text stays the
same because it is just html below the photo.
Ideally I would like the caption to be relevant to the picture but I
actually have no idea how to do it.
Anyone care to lend a hand and help?
Thanks
The site is www.vorsters.com
The code for changing the picture is:
<script language="JavaScript" type="text/JavaScript">
var j,l="",m="",p="",q="",z="",list= new Array()
list[list.length]='images/potd/potd01.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd02.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd03.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd04.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd05.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd06.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd07.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd08.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd09.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd10.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd11.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd12.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd13.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd14.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd15.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd16.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd17.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
j=parseInt(Math.random()*list.length);
j=(isNaN(j))?0:j;
if (list[j].indexOf('?')==-1) {
document.write("<img src='"+list[j]+"'>");
}
else {
nvp=list[j].substring(list[j].indexOf('?')+2).split('&');
for(var i=0;i<nvp.length;i++) {
sub=nvp.split('=');
switch(sub[0]) {
case 'link':
l="<a href='"+unescape(sub[1])+"'>";
p="</a>";
break;
case 'target':
q=" target='"+unescape(sub[1])+"'";
break;
default:
m+=" "+sub[0]+"='"+unescape(sub[1])+"'";
break;
}
}
z=(l!="")?((q!="")?l.substring(0,l.length-1)+q+">":l):"";
z+="<img
src='"+list[j].substring(0,list[j].indexOf('?'))+"'"+m+">"+p;
document.write(z);
}
</script>
website. It changes whenever refreshed.
Below the picture, you will see text. At the moment the text stays the
same because it is just html below the photo.
Ideally I would like the caption to be relevant to the picture but I
actually have no idea how to do it.
Anyone care to lend a hand and help?
Thanks
The site is www.vorsters.com
The code for changing the picture is:
<script language="JavaScript" type="text/JavaScript">
var j,l="",m="",p="",q="",z="",list= new Array()
list[list.length]='images/potd/potd01.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd02.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd03.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd04.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd05.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd06.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd07.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd08.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd09.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd10.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd11.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd12.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd13.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd14.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd15.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd16.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
list[list.length]='images/potd/potd17.jpg?&alt=Picture Of The
Day&border=1&link=index.htm';
j=parseInt(Math.random()*list.length);
j=(isNaN(j))?0:j;
if (list[j].indexOf('?')==-1) {
document.write("<img src='"+list[j]+"'>");
}
else {
nvp=list[j].substring(list[j].indexOf('?')+2).split('&');
for(var i=0;i<nvp.length;i++) {
sub=nvp.split('=');
switch(sub[0]) {
case 'link':
l="<a href='"+unescape(sub[1])+"'>";
p="</a>";
break;
case 'target':
q=" target='"+unescape(sub[1])+"'";
break;
default:
m+=" "+sub[0]+"='"+unescape(sub[1])+"'";
break;
}
}
z=(l!="")?((q!="")?l.substring(0,l.length-1)+q+">":l):"";
z+="<img
src='"+list[j].substring(0,list[j].indexOf('?'))+"'"+m+">"+p;
document.write(z);
}
</script>