Need help deciphering some code

Discussion in 'HTML' started by Cogito, Jul 20, 2007.

  1. Cogito

    Cogito Guest

    The following site does exactly what I am trying to do but, no matter
    how much I study the code I cannot figure out how it is done.

    I want to have a page with list of radio station links and one 'media
    player' panel. When a link is clicked that station should start
    playing.

    Can someone please make up a clear code example how this is done?

    In the following link, most, but not all stations are working. The two
    ABC stations on the right of the 4th row from the top do work.

    The link:
    http://www.radioguide.fm/internet_radio_Australia
     
    Cogito, Jul 20, 2007
    #1
    1. Advertising

  2. While the city slept, Cogito () feverishly typed...

    > The following site does exactly what I am trying to do but, no matter
    > how much I study the code I cannot figure out how it is done.
    >
    > I want to have a page with list of radio station links and one 'media
    > player' panel. When a link is clicked that station should start
    > playing.
    >
    > Can someone please make up a clear code example how this is done?
    >
    > In the following link, most, but not all stations are working. The two
    > ABC stations on the right of the 4th row from the top do work.
    >
    > The link:
    > http://www.radioguide.fm/internet_radio_Australia


    The links for the radio stations are of the fashion;

    <a onclick="go('3awradau');" href="#">

    If javascript is available, this calls the function go() which is below;

    function go(korteNaam){
    if(korteNaam.length > 1){
    setSource(korteNaam);
    }
    return false;
    }

    this basically calls the function setSource() which is below;

    function setSource(zenderNaam){
    if (d.getElementById){
    d.getElementById("player").src="player.php?zender=" + zenderNaam;
    }else if(d.all){
    d.all.player.src="player.php?zender=" + zenderNaam;
    }
    }

    s/he also specifies (outside of the functions);

    var d = document;
    var w = window;

    what setSource() does is set the source of the element which has the id
    "player" (which will be the media player) to player.php?zender=(whichever
    station selected)

    It could be a little more graceful by using something like

    <a href="player.php?zender=3awradau" onclick="return go('3awradau');">

    which should allow it to work even if javascript is not available to the
    end-user.

    Hope that helps,
    Nige

    --
    Nigel Moss http://www.nigenet.org.uk
    Mail address will bounce. | Take the DOG. out!
    "Your mother ate my dog!", "Not all of him!"
     
    nice.guy.nige, Jul 20, 2007
    #2
    1. Advertising

  3. Cogito

    Cogito Guest

    On Fri, 20 Jul 2007 21:03:10 +0100, "nice.guy.nige"
    <> wrote:

    >While the city slept, Cogito () feverishly typed...
    >
    >> The following site does exactly what I am trying to do but, no matter
    >> how much I study the code I cannot figure out how it is done.
    >>
    >> I want to have a page with list of radio station links and one 'media
    >> player' panel. When a link is clicked that station should start
    >> playing.
    >>
    >> Can someone please make up a clear code example how this is done?
    >>
    >> In the following link, most, but not all stations are working. The two
    >> ABC stations on the right of the 4th row from the top do work.
    >>
    >> The link:
    >> http://www.radioguide.fm/internet_radio_Australia

    >
    >The links for the radio stations are of the fashion;
    >
    ><a onclick="go('3awradau');" href="#">
    >
    >If javascript is available, this calls the function go() which is below;
    >
    >function go(korteNaam){
    >if(korteNaam.length > 1){
    >setSource(korteNaam);
    >}
    >return false;
    >}
    >
    >this basically calls the function setSource() which is below;
    >
    >function setSource(zenderNaam){
    > if (d.getElementById){
    > d.getElementById("player").src="player.php?zender=" + zenderNaam;
    > }else if(d.all){
    > d.all.player.src="player.php?zender=" + zenderNaam;
    > }
    >}
    >
    >s/he also specifies (outside of the functions);
    >
    >var d = document;
    >var w = window;
    >
    >what setSource() does is set the source of the element which has the id
    >"player" (which will be the media player) to player.php?zender=(whichever
    >station selected)
    >
    >It could be a little more graceful by using something like
    >
    ><a href="player.php?zender=3awradau" onclick="return go('3awradau');">
    >
    >which should allow it to work even if javascript is not available to the
    >end-user.
    >
    >Hope that helps,
    >Nige


    Thanks for your reply. I'm familiar with HTML but I'm not sure how to
    use your code.
    Would you be able to surround your code with the necessary html to
    make it a working sample of 2 playing stations?
    If I saw a simple working example I may understand it better and be
    able to adapt it to my needs.
    Thanks in advance.
     
    Cogito, Jul 21, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Philip S

    Deciphering ISO C (Chap 6.3.2.3 - Pointers)

    Philip S, Nov 10, 2003, in forum: C Programming
    Replies:
    2
    Views:
    439
    Keith Thompson
    Nov 10, 2003
  2. John

    stat.st_mode deciphering

    John, Jun 19, 2004, in forum: C Programming
    Replies:
    1
    Views:
    737
  3. rodchar

    deciphering trace info

    rodchar, Aug 8, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    385
    rodchar
    Aug 18, 2008
  4. johkar
    Replies:
    3
    Views:
    2,043
    johkar
    Jul 10, 2009
  5. jbowers
    Replies:
    2
    Views:
    87
    jbowers
    Apr 27, 2007
Loading...

Share This Page