Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Template design and Front-End Code

Post Reply
 
Thread Tools
  #1  
Old 12-27-2008, 07:55 AM
constant's Avatar
constant Offline
forum loafer
 
Join Date: Dec 2008
Location: Portland, Oregon
Posts: 9
Question window.onload problem?

Not sure if this is really a Pixelpost issue, but googling doesn't seem to help either so maybe experts here can point me in the right direction.

My problem is related to my photoblog pages occasionally not loading properly. This problem only seems to happen in IE (I use V7.0, not sure if it happens in other versions).

I feel that I have tracked it down to window.onload event not being called when the html page is loaded. I'm using the "TheWorldIn35mm" template which hooks into the onload event to actually load the current image and fade it in using java script.

Here is a stripped down verson of the code:

Code:
<script type="text/javascript">
window.onload = function() {
	// update title to include image title
	document.title =  document.title + ' - <IMAGE_TITLE>';
	var img = document.getElementById('photo');

	img.onload = function(evt) {
		//image fade in code here
		   :
	}
	// set img src
	img.src = '<SITE_URL>images/<IMAGE_NAME>';
};
</script>
When the problem happens (and it is totally random as to when it happens) the page displays with no image and I can tell the onload function has not been called as the document title does not get changed to include the image title, which would be the effect of the first line of code that would be executed if the onload function ran.

I'm thinking that if there were some issues with the onload event not firing then it would be well documented on the net but I can't find any mention of other people ever experiencing this type of problem with window.onload(), so it must be something else.

Has anyone else had any experience similar to mine? Are there any tests I can do to better pinpoint the problem? I'm a newbie to web coding so be gentle please.
__________________
constant clicking
Reply With Quote
  #2  
Old 12-27-2008, 01:02 PM
Dennis's Avatar
Dennis+ Offline
Team Pixelpost
 
Join Date: Jul 2006
Posts: 2,394
Send a message via MSN to Dennis
Moved to template and designs.
__________________
My photoblog, powered by PixelPost 1.9 dev SVN | My Pixelpost Addons | My Cool Photoblog profile
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 12:28 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs