1

I am trying to have a flash-based music player on my page which continues playing a song even when you refresh or go to another page within the web site.

I whant do this like facebook footer

i read this topic How does Facebook keep the header and footer fixed while loading a different page?

but i have loadpage() and location.hash problem

if someone know how its made plz tell me

Community
  • 1
  • 1
  • 4
    What "loadpage() and location.hash problem" are you having? What exactly have you done, what did you expect to happend and what exactly happend instead? – Michael Borgwardt Jul 27 '09 at 09:26

2 Answers2

2
var header = document.getElementById('header');
var headerLinks = header.getElementsByTagName('a');
for(var i = 0, l = headerLinks.length; i < l; i++) 
{ 
 headerLinks[i].onclick = function() {    
var href = this.href;   
 //Load the AJAX page (this is a whole other topic)    
loadPage(href);      
//Update the address bar to make it look like you were redirected   
 location.hash = '#' + href;    
//Unfocus the link to make it look like you were redirected    
this.blur();   
 //Prevent the natural HTTP redirect    
return false;  

}}

CSS:

#Footer  {  
font-size:xx-small;   
text-align:left;   
width:100%;   
bottom:0px;   
position:fixed;   
left:0px;   
background-color: #CCCCCC;   
border-top: 1px solid #999999;   
padding:4px;   
padding-right:20px;   
color:#666666; 
}

I have done so this code not worked, i want to do not refresh area for music player like google videos or facebook task bar

I have done so

function links() {
    //var header = document.getElementById("header");
    var headerLinks = document.getElementsByTagName("a");
    for (var i = 0, l = headerLinks.length; i < l; i++) {
        headerLinks[i].onclick = function() {
            var href = this.href;
            loadPage(href);
            window.location.hash = "#" + href;
            this.blur();
           return false;
        }
    }
}

window.onload = function() {
    links();
}

i whant to all links to modify but it's not worked

  • 1
    More details, please! What does it mean that it hasn't worked? What happened? Did you get an error message? Did your browser crash? Did nothing happen at all? – Prestaul Jul 27 '09 at 13:59
1

It looks like you are pretty new to javascript. If that is the case then doing a full ajax site is probably not the place to start. I think you should try going old-school and using frames to accomplish this. (This is how Google Video used to function, and Google Images still uses this technique.)

<html>
    <frameset rows="200px,*,200px">
        <frame src="yourPageHeaderWithFlashPlayer.html" noresize="noresize"/>
        <frame src="yourMainContent.html" noresize="noresize"/>
        <frame src="yourPageFooter.html" noresize="noresize"/>
    </frameset>
</html>

That would work for a 200px header and 200px footer. If you need more info: http://www.w3schools.com/tags/tag_frameset.asp.

Prestaul
  • 83,552
  • 10
  • 84
  • 84
  • i know that but i want to do it using javascript –  Jul 27 '09 at 14:03
  • 1
    Prestaul is correct -- what you're trying to do is very advanced and is going to require a deep understanding of the language. If you're not *very* comfortable in Javascript, proceed with caution. – Josh Jul 31 '09 at 02:02