constant
12-27-2008, 07:55 AM
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:
<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. :)
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:
<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. :)