View Full Version : js loaded images causing moz to continue loading after page is finished

evil kev
02-02-2005, 05:39 PM
hey. first apologies if this wrong place i figured that although my script uses dom functions the bug is still there without them so it wasn't actually a dom problem so i thought it was more suited to this area.

in my script a form is dynamically created for people to add comments to posts so far so good but for smilies and bbcode i created drop down menus and the images in them appears to cause problems in moz and ns7 (for example see http://fuzz.crazybobbles.org ) the problem is that when the page has finished loading it says "waiting for *server*" in the status bar indicating its still loading stuff when i know its finished. i've moved the image creation functions to the header rather than in the dom scripting where the form is created but this just means that it now does the "waiting for *server*" the entire time the page is open. i tried changing my document.createElement() to new Image() fucntion but the problem was the same

i've isolated the problem to the .src object of the image (i tried setAttribute('src','blah') before same result.

here's the code

imgbb = new Array()
for(z=0;z <= 13;z++){
imgbb[z] = document.createElement('img');
imgbb[z].onclick = addsmilie;
imgbb[0].src = 'buttons/bold.gif';
imgbb[0].setAttribute('alt', '');
imgbb[0].setAttribute('title', 'Add bold tags');
imgbb[1].src = 'buttons/italic.gif';
imgbb[1].setAttribute('alt', '');
imgbb[1].setAttribute('title', 'Add italic tags');

etc etc until gone through all 14 array spots

(note i was using the usual i variable for the loop before but it was triggering the vbulletin italic code so i just quickly modded it to z :)

its only the src bit its having problems with i believe is there anything i can do? it works fine in opera, ie so i'm quite surprised at firefox not liking it? hmm any ideas?

evil kev
02-02-2005, 09:56 PM
hmm i've done more research on this and i've found my same problem on a couple of sites but not other ones i'm tres confused with it :confused:

i wrote a bare bones script that still shows the problem

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<title>image test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript">
window.onload = init;

function init(){

img = new Image();
img.src = "http://www.asyl20.dsl.pipex.com/commando.jpg";


<p>test script</p>


and in ie and opera everything works fine but firefox still says "waiting for www.asyl20.dsl.pipex.com" even after the image has definatly loaded (i wrote a slightly more complex script where it'd appear on an onclick. i'm quite torn as to whether this is a firefox bug or my scripting is off its just annoying :mad:

evil kev
02-07-2005, 03:46 PM
*bump* still hoping for a solution or something any ideas :confused:

02-07-2005, 04:18 PM
okay so u are just trying to preload the images if i assume correct, it seems to work if they aren't in a function :confused:

<script type="text/javascript"><!--
img1=new Image();
img1.src = "http://www.asyl20.dsl.pipex.com/commando.jpg";
not quite sure y i tried document.close(); thinking that may be the problem, maybe someone more enlightened in javascript will give a reason to this, hmm i found this i dunno if it will help or not http://www.webreference.com/programming/javascript/gr/column3/

02-07-2005, 06:27 PM
Do you have access to your server's error log? That would tell you if the request included a file that wasn't fulfilled, or anything like that.