This Message Forum is no longer in use

Please use the new Bravenet Help Forums FOUND HERE

General Forum
This Forum is Locked
Author
Comment
Focus to top of page

I have the photo album embedded in my page but when the page loads it always has the focus at the top of the photo album and not at the top of the page, thereby cutting out the menu.
Any way of getting the focus back to the top?

Re: Focus to top of page

Can you post your code. Never know, it could just be a minor error or a manner at which it is being executed.

Re: Focus to top of page

POST A LINK TO YOUR SITE NOT THE HTML CODE HERE

You can look at his source code that way

Re: Focus to top of page

It wasn't anything to do with my coding. I was using Bravenets embeded photo album and when I raised a support ticket, I received this reply from Bravenet: "Sorry, There is coding within the Photo Album service that is making that happen and the option to alter that is not available.".
So it means when the page loads, it puts the focus at the top of the photo album, and below the menu. What I need is something that will wait for the album to load and focus, and then refocus the page back to the top.

Re: Focus to top of page

I tried the following code on a free web site with the Embedded Photo Album. Initially, like your site, the Embedded Photo Album links to the instance of the album in your HTML page. But after adding the code below, the page still initially sets itself to display the album, but then scrolls up to the top of the page.

Code:
<body onLoad="self.scrollTo(0,0)">


If you are not using something like the Website Wizard, you probably won't be able to do this. The Wizard doesn't give you access to the "body" tag. Then you might have to do something a little messier, with Javascript. But I can't tell if your using the Wizard, because you haven't posted a link.

Browser: Firefox, Netscape, Sea Monkey, Internet Explorer, .....

OS: Solaris (Sparc,x86), Linux, XP

Re: Focus to top of page

Uh..
a "not" too many in that sentence?

Re: Focus to top of page

Yes, that last paragraph should read:

If you are using something like the Website Wizard, you probably won't be able to do this. The Wizard doesn't give you access to the "body" tag. Then you might have to do something a little messier, with Javascript. But I can't tell if your using the Wizard, because you haven't posted a link.


I guess that's what happens when you get interrupted 10 times writing a 10 minute response.

Browser: Firefox, Netscape, Sea Monkey, Internet Explorer, .....

OS: Solaris (Sparc,x86), Linux, XP

Re: Focus to top of page

I tried the onload to focus the page to (0,0) and it does work, but whatever is in the Bravenet script did a re-focus back to the top of the photo album.

Re: Focus to top of page

To start, you have a small error in your "body" tag. It is missing the terminating right arrow. It doesn't seem to bother anything, but it should be fixed.

When Bravenet's Embedded Photo Album starts, it does try to change the "top of page". It adds a link target on the end of your web page URL. But I looked at your page in IE and Firefox. IE didn't have any problems. The top of page was always correct. Only Firefox had a problem.

So then I started to look for the real issue. When I am troubleshooting a page, I initially remove anything that is not relevant to the page displaying. So I started by removing your counter and the Google ads. The debugger didn't show any real issues. Just a bunch of complaints about style definitions. Your "style.css" and "print.css" have a bunch of declarations that are not acceptable or just incorrect. But those are OK too. Bravenet's code has a lot if issues also. But overall, no real scripting errors.

Then I noticed the small bit of Javascript embedded about 350 lines from the top. There I see another "onload" function. So you have a "onload" operation in the "body" tag and a function assigned to the "window[dot]onload" operation embedded in the HTML code. This kind of thing is not recommended, because one operation may override the other. It can be inconsistent between browsers. The actual recommendation is to take the operations required from the "window[dot]onload" function and put it in the "body" "onload" operation. This eliminates any conflicts that might exist.

But, I didn't want to make any sweeping changes to the web page, and my dogs needed to be fed, so I just added an extra command to the "window[dot]onload" function definition. The code is listed below. I highlighted the added command.

Code:
window.onload = function() {
hidebar();
if (window.sizeLines) sizeLines();
<span style="font-weight:bold;">setTimeout('self.scrollTo(0,0)',30);</span>
}


The code sets a timeout of 30 milliseconds, before it executes the command. This makes the display flash quickly, but it's hardly noticeable. To see it work, increase the delay to 2000 milliseconds. The page will act normally and then scroll to the top after 2 seconds. While 30 milliseconds worked for me, you may have to play with it a bit and extend it a little longer, to account for network delays.

Browser: Firefox, Netscape, Sea Monkey, Internet Explorer, .....

OS: Solaris (Sparc,x86), Linux, XP

Re: Focus to top of page

You little beauty!! That works an absolute treat. Thank you so much for taking the time to have a look at my page and suggest a solution. Very much appreciated.
And yes, I have started to fix the errors you have mentioned as well.
Once again.... thanks!!