Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2003
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    New Coder
    Join Date
    Jan 2003
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •