Question posted by: Rick
(Guest)
on
July 20th, 2005 09:37 AM
I have a script of rolling images. I would like it so that each time
an image changes in cell1 some text in cell2 changes. How can this be
done.
<html>
<head>
<title>TITLE</title>
<title>Test Page</title>
<script language="JavaScript">
var i = 1;
banner1= new Image();
banner1.src = "one.jpg";
banner2= new Image();
banner2.src = "two.jpg";
banner3= new Image();
banner3.src = "three.jpg";
banner4 = new Image();
banner4.src = "four.jpg";
banner5 = new Image();
banner5.src = "five.jpg";
// Status Bar Description of image
var description = new Array
description[1] = "one"
description[2] = "two"
description[3] = "three"
description[4] = "four"
description[5] = "five"
function loadBanner(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
closeTime=hours*3600+mins*60+secs;
// Change this number to increase decrease the rotation speed
closeTime+=3;
Timer();
}
function Timer(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
curTime=hours*3600+mins*60+secs
if (curTime>=closeTime){
if (i < 5){
i++;
document.banner.src = eval("banner" + i +
".src");
}
else{
i = 1;
document.banner.src = eval("banner" + i +
".src");
} loadBanner();
}
else{
window.setTimeout("Timer()",1000)}
}
function clickLink(){
top.location = links[i]
}
function descript(){
window.status = description[i]
}
function nothing() {
window.status=""
}
function changeAlt(){
for (pic = 0; pic<document.images.length; pic++)
{
//document.images[pic].alt = pic+1 //image count
document.images[pic].alt = description[i] //image source
//document.images[pic].alt =
document.images[pic].width+'x'+document.images[pic].height+'Pixel' //image
size
//document.images[pic].alt =
document.images[pic].fileSize+'Byte' //image byte
//document.images[pic].alt =
document.images[pic].fileUpdatedDate //image upload
}
}
function changeAltBack(){
for (pic = 0; pic<document.images.length; pic++)
{
//document.images[pic].alt = pic+1 //image count
document.images[pic].alt = "" //image source
//document.images[pic].alt =
document.images[pic].width+'x'+document.images[pic].height+'Pixel' //image
size
//document.images[pic].alt =
document.images[pic].fileSize+'Byte' //image byte
//document.images[pic].alt =
document.images[pic].fileUpdatedDate //image upload
}
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#006633" vlink="#800080"
alink="#ff0000">
<div align="center">
<table width="425" border="2" cellspacing="0" cellpadding="0">
<tr>
<td width="25" height="418"></td>
<td width="400" valign="top"> <div align="center">
<table width="200" border="2" cellpadding="0"
cellspacing="0" bgcolor="#FFFFD9">
<tr>
<td width="182" height="180"><p align="center"><body
bgcolor = blue
text = white
link = white
vlink= white
alink= white
onload="loadBanner();">
<p><a href=""
onClick="clickLink(); return false;"
onMouseOver="changeAlt(); return true;"
onmouseout="changeAltBack(); return false;"
target = new>
<!-- Load initial image here --><img src="one.jpg"
width="200" height="200" border="0""
border=0
name="banner"[color=blue]
>[/color]
</a></p></td>
</tr>
<tr>
<td width="200" height="200"> <div align="right">
</div></td>
</tr>
</table>
</div></td>
</tr>
</table>
</div>
</body>
</html>
|
|
July 20th, 2005 09:37 AM
# 2
|
Re: Chagne contents of one cell based on another
On newer browsers, you can use the innerHTML to do this.
Rick wrote:
[color=blue]
> I have a script of rolling images. I would like it so that each time
> an image changes in cell1 some text in cell2 changes. How can this be
> done.
>
> <html>
>
> <head>
>
> <title>TITLE</title>
>
> <title>Test Page</title>
>
> <script language="JavaScript">
> var i = 1;
> banner1= new Image();
> banner1.src = "one.jpg";
> banner2= new Image();
> banner2.src = "two.jpg";
> banner3= new Image();
> banner3.src = "three.jpg";
> banner4 = new Image();
> banner4.src = "four.jpg";
> banner5 = new Image();
> banner5.src = "five.jpg";
>
> // Status Bar Description of image
>
> var description = new Array
> description[1] = "one"
> description[2] = "two"
> description[3] = "three"
> description[4] = "four"
> description[5] = "five"
>
> function loadBanner(){
>
> var time= new Date();
> hours= time.getHours();
> mins= time.getMinutes();
> secs= time.getSeconds();
> closeTime=hours*3600+mins*60+secs;
>
> // Change this number to increase decrease the rotation speed
> closeTime+=3;
>
> Timer();
>
> }
>
> function Timer(){
> var time= new Date();
> hours= time.getHours();
> mins= time.getMinutes();
> secs= time.getSeconds();
> curTime=hours*3600+mins*60+secs
> if (curTime>=closeTime){
> if (i < 5){
> i++;
> document.banner.src = eval("banner" + i +
> ".src");
> }
> else{
> i = 1;
> document.banner.src = eval("banner" + i +
> ".src");
> } loadBanner();
> }
> else{
> window.setTimeout("Timer()",1000)}
>
> }
>
> function clickLink(){
> top.location = links[i]
> }
>
> function descript(){
> window.status = description[i]
> }
>
> function nothing() {
> window.status=""
> }
>
> function changeAlt(){
> for (pic = 0; pic<document.images.length; pic++)
> {
> //document.images[pic].alt = pic+1 //image count
> document.images[pic].alt = description[i] //image source
> //document.images[pic].alt =
> document.images[pic].width+'x'+document.images[pic].height+'Pixel' //image
> size
> //document.images[pic].alt =
> document.images[pic].fileSize+'Byte' //image byte
> //document.images[pic].alt =
> document.images[pic].fileUpdatedDate //image upload
> }
> }
>
> function changeAltBack(){
> for (pic = 0; pic<document.images.length; pic++)
> {
> //document.images[pic].alt = pic+1 //image count
> document.images[pic].alt = "" //image source
> //document.images[pic].alt =
> document.images[pic].width+'x'+document.images[pic].height+'Pixel' //image
> size
> //document.images[pic].alt =
> document.images[pic].fileSize+'Byte' //image byte
> //document.images[pic].alt =
> document.images[pic].fileUpdatedDate //image upload
> }
> }
>
> </script>
> </head>
>
> <body bgcolor="#FFFFFF" text="#000000" link="#006633" vlink="#800080"
> alink="#ff0000">
>
> <div align="center">
> <table width="425" border="2" cellspacing="0" cellpadding="0">
> <tr>
> <td width="25" height="418"></td>
> <td width="400" valign="top"> <div align="center">
> <table width="200" border="2" cellpadding="0"
> cellspacing="0" bgcolor="#FFFFD9">
> <tr>
> <td width="182" height="180"><p align="center"><body
> bgcolor = blue
> text = white
> link = white
> vlink= white
> alink= white
> onload="loadBanner();">
> <p><a href=""
> onClick="clickLink(); return false;"
> onMouseOver="changeAlt(); return true;"
> onmouseout="changeAltBack(); return false;"
> target = new>
> <!-- Load initial image here --><img src="one.jpg"
> width="200" height="200" border="0""
> border=0
> name="banner"[color=green]
> >[/color]
> </a></p></td>
> </tr>
> <tr>
> <td width="200" height="200"> <div align="right">
> </div></td>
> </tr>
> </table>
> </div></td>
> </tr>
> </table>
>
> </div>
>
> </body>
>
> </html>[/color]