Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-17-2003, 10:39 PM   PM User | #1
balltom
New Coder

 
Join Date: Jan 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
balltom is an unknown quantity at this point
Question Java and frames....

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
balltom is offline   Reply With Quote
Old 01-27-2003, 04:46 AM   PM User | #2
balltom
New Coder

 
Join Date: Jan 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
balltom is an unknown quantity at this point
Nevermind... I fixed it.
It was a bug
due to some f' 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!
balltom is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:37 PM.


Advertisement
Log in to turn off these ads.