#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Posts
    5
    Rep Power
    0

    frames divs variables javascript.


    I have an application that uses frames; in one of the frames I have a variable that gets changed dynamically by php code and a java applet. This variable changes often during any single browser session.

    I need to accomplish the following:

    In frame A I need to display variable "artistid" that I retrieved from frame B without reloading frame A:

    I know how to get the variable like this:

    var artistid = top.frames[3].pick3.artistid;

    I need this to happen every few seconds automatically, without any clicking or rollovers or anything.

    It has to work in IE4+ and NS4+

    I know it has to do with layers and divs, and I know I will need some kind of setTimeout call but I am vary new at JavaScript and I can't figure this one out. PHP and Unix shell I'm good at but not JavaScript.

    I know how to get it done using JavaScript and php IF I reload the frame but I have a lot of stuff in that frame and I don't want to reload it again, I just want to display the value of "artistid" every few seconds after having again retrieved it from frame A in case it has changed.

    Can you please help me or point me to someplace where I could find what need?

    Thank you so very much for your help

    Paul
  2. #2
  3. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    Could give this a shot...


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>untitled</title>
    <style type="text/css">

    .artist {
    font: 600 14px "comic sans ms";
    color: coral;
    }

    </style>
    <script type="text/javascript" language="JavaScript">

    var IDtimer = null;

    function setCell() {
    var cell, artistid = 'Bob Dylan'; // top.frames[3].pick3.artistid;
    if (artistid) {
    if (!document.layers) {
    cell = document.getElementById ? document.getElementById('readout') :
    document.all ? document.all('readout') : null;
    if (cell && typeof cell.innerHTML != 'undefined') cell.innerHTML = artistid;
    } else {
    cell = document.NSreadout.document.layers[0];
    cell.document.write('<span class="artist">' + artistid + '</span>')
    cell.document.close();
    }
    }
    }

    onload = function() {
    IDtimer = setInterval('setCell()',5);
    }

    onunload = function() {
    clearInterval(IDtimer);
    }

    </script>
    </head>
    <body bgcolor="black">
    <table cellspacing="0" cellpadding="0" border="0">
    <tr>
    <td id="readout" class="artist" width="100" height="16"><ilayer id="NSreadout"><layer width="100" height="16"></layer></ilayer></td>
    </tr>
    </table>
    </body>
    </html>

    Last edited by adios; December 12th, 2002 at 01:19 PM.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Posts
    5
    Rep Power
    0
    wow Ill try it, this is a lot more than I had hoped for.

    Thank you so much for the help. I hope I am able to understand it well so I can use it.

    Thanks again from me and from all the artist that will benefit from it.

    Paul

IMN logo majestic logo threadwatch logo seochat tools logo