Chagne contents of one cell based on another

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rick

    Chagne contents of one cell based on another

    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="JavaS cript">
    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+s ecs;

    // 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*3 600+mins*60+sec s
    if (curTime>=close Time){
    if (i < 5){
    i++;
    document.banner .src = eval("banner" + i +
    ".src");
    }
    else{
    i = 1;
    document.banner .src = eval("banner" + i +
    ".src");
    } loadBanner();
    }
    else{
    window.setTimeo ut("Timer()",10 00)}

    }

    function clickLink(){
    top.location = links[i]
    }

    function descript(){
    window.status = description[i]
    }

    function nothing() {
    window.status=" "
    }


    function changeAlt(){
    for (pic = 0; pic<document.im ages.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'+docu ment.images[pic].height+'Pixel' //image
    size
    //document.images[pic].alt =
    document.images[pic].fileSize+'Byte ' //image byte
    //document.images[pic].alt =
    document.images[pic].fileUpdatedDat e //image upload
    }
    }

    function changeAltBack() {
    for (pic = 0; pic<document.im ages.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'+docu ment.images[pic].height+'Pixel' //image
    size
    //document.images[pic].alt =
    document.images[pic].fileSize+'Byte ' //image byte
    //document.images[pic].alt =
    document.images[pic].fileUpdatedDat e //image upload
    }
    }




    </script>
    </head>



    <body bgcolor="#FFFFF F" 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="#FFFFD 9">
    <tr>
    <td width="182" height="180"><p align="center"> <body
    bgcolor = blue
    text = white
    link = white
    vlink= white
    alink= white
    onload="loadBan ner();">
    <p><a href=""
    onClick="clickL ink(); return false;"
    onMouseOver="ch angeAlt(); return true;"
    onmouseout="cha ngeAltBack(); 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>
  • Greg Griffiths

    #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="JavaS cript">
    > 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+s ecs;
    >
    > // 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*3 600+mins*60+sec s
    > if (curTime>=close Time){
    > if (i < 5){
    > i++;
    > document.banner .src = eval("banner" + i +
    > ".src");
    > }
    > else{
    > i = 1;
    > document.banner .src = eval("banner" + i +
    > ".src");
    > } loadBanner();
    > }
    > else{
    > window.setTimeo ut("Timer()",10 00)}
    >
    > }
    >
    > function clickLink(){
    > top.location = links[i]
    > }
    >
    > function descript(){
    > window.status = description[i]
    > }
    >
    > function nothing() {
    > window.status=" "
    > }
    >
    > function changeAlt(){
    > for (pic = 0; pic<document.im ages.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'+docu ment.images[pic].height+'Pixel' //image
    > size
    > //document.images[pic].alt =
    > document.images[pic].fileSize+'Byte ' //image byte
    > //document.images[pic].alt =
    > document.images[pic].fileUpdatedDat e //image upload
    > }
    > }
    >
    > function changeAltBack() {
    > for (pic = 0; pic<document.im ages.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'+docu ment.images[pic].height+'Pixel' //image
    > size
    > //document.images[pic].alt =
    > document.images[pic].fileSize+'Byte ' //image byte
    > //document.images[pic].alt =
    > document.images[pic].fileUpdatedDat e //image upload
    > }
    > }
    >
    > </script>
    > </head>
    >
    > <body bgcolor="#FFFFF F" 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="#FFFFD 9">
    > <tr>
    > <td width="182" height="180"><p align="center"> <body
    > bgcolor = blue
    > text = white
    > link = white
    > vlink= white
    > alink= white
    > onload="loadBan ner();">
    > <p><a href=""
    > onClick="clickL ink(); return false;"
    > onMouseOver="ch angeAlt(); return true;"
    > onmouseout="cha ngeAltBack(); 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]

    Comment

    Working...