...

View Full Version : Java and frames....



balltom
01-17-2003, 10:39 PM
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 :mad:


Any ideas?:confused:

Thanks in advance.

Tom

balltom
01-27-2003, 04:46 AM
Nevermind... I fixed it.
It was a bug :mad: :mad: :mad:
due to some f':mad: ing lines that Frontpage has generated on top of my code:
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

Don't know what was the problem but when I removed it, it works!:p



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum