Folks,
I have a little problem that I need your help about...
My web site has 2 frames: header.html and body.asp.
The header frame contains a little menu bar with hyperlinks to other pages on my site.
I have a little script that loads midi music files for people on my web to listen as they browse.
This scrits randomly selects a song and plays it.
<SCRIPT language=JavaScript>
......
function change(){
stopped=0
clearTimeout(timer);
if(index==song.length){ // if at end of playlist start from beginning
index=0;
document.all.track.src = song[0][0]
}
else{
document.all.track.src = song[index][0]
}
window.status="Music ---- > Track "+(index+1)+" of "+song.length+" <<< "+song[index][1].substring(song[index][1].length,0)+" >>>"
if(loadnum<song.length){ // if played for first time add download time to play time
loadnum++
index++
timer=setTimeout("change()",250000)
}
else{
if(loadnum==song.length){ // if not first play keep to play time
index++
timer=setTimeout("change()",200000)}
}
}
function stop(){
if(stopped==1){return}
stopped=1
clearTimeout(timer);
index=index-1
document.all.track.src =""
window.status="Player Stopped"
}
setTimeout("init()",1000)
//-->
</SCRIPT>
<BGSOUND SRC="" ID="track" VOLUME="0">
There is also a "stop" and "start" button that runs a function on the script to stop or start the music to play:
<a href="javascript
:stop()">Stop</a> || <a href="javascript
:change()">Start</a>
The scripts source is located in the header.html page. Then the buttons appears on the header frame (menu bar).
Runs great when I load only the header.html page alone.
The music plays and can be stopped and started using the buttons.
If I load my 2 pages (header.html and body.asp) in a frameset, when I click on any button I receive the "object not found" error message.
It seems that JS is looking in the body.asp document to find the source. Even if the buttons are in the header.html
Any ideas?
Thanks in advance.
Tom