Forum Moderators: open

Message Too Old, No Replies

NEED help with javascript

         

cesco

12:41 am on Feb 13, 2006 (gmt 0)



Hi everyone,
i really need help with this script. Let me tell you that I'm not that good with javascripts.
This is a script that is suppose to give information from an internet radio (station name, song title, song artist ...) and update the song info when the next song starts playing.
Here is the script:

file1.js:
function getObj(name)
{
if (document.all)
{
return document.all[name];
} else {
return document.getElementById(name);
}
}

function changeInnerHTML(theId,theHTML){
try{
oobj = getObj(theId);
//alert(theId+"---"+theHTML);
oobj.innerHTML=theHTML;
}catch(e){
}
}

// this part is on another file: file2.asp
<script src="/file1.js"></script>
function setStationInfo(stationText,artistText,songText)
{
//alert(stationText+"--"+artistText+"--"+songText+"--"+albumText+"--"+buyUrl)
if(stationText!="")
{
x = getObj("station");
x.innerHTML=stationText;
}
if(artistText!=" [0:0]")
{
x = getObj("artist");
x.innerHTML=artistText;
}
if(songText!="")
{
x = getObj("song");
x.innerHTML=songText;
}

</script>
//calling the function (this is where i'm LOST
<script xmlns:ui="urn:ui">
parent.setRefresh(21);
setStationInfo("XXX","YYY", "ZZZ");</script>

Question:
when I run the script, the station info does not change when sthe song change, All that is displayed is the "XXX", "YYY, and "ZZZ" and I understand why (this is obvious). What I want to know is WHAT do I put in place of the "XXX" "YYY" "ZZZ" so that I get the proper song info when a new song starts. I hope my question is clear.

Thank you SO much for your help.

Iguana

11:17 am on Feb 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi cesco

welcome to Webmasterworld!

Since no-one else has attermpted an answer, I'll give it a go. The javascript functions simply display whatever you send in the setStationInfo() call. Your problem is how do you get hold of the station, artist and song info.

Perhaps this is javascript that the station can put on its own pages to display the current song? In which case they will have a way of inserting the current song into the XXX YYY ZZZ variables.