Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Feb 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    js loaded images causing moz to continue loading after page is finished

    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
    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?

  • #2
    New to the CF scene
    Join Date
    Feb 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

    i wrote a bare bones script that still shows the problem

    Code:
    <!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">
    <head>
    	<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";
    	}
    	//-->
    	</script>
    </head>
    
    <body>
    
    <p>test script</p>
    
    </body>
    </html>
    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

  • #3
    New to the CF scene
    Join Date
    Feb 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    *bump* still hoping for a solution or something any ideas

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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
    Code:
    <script type="text/javascript"><!--
    img1=new Image();
    img1.src = "http://www.asyl20.dsl.pipex.com/commando.jpg";
    //-->
    </script>
    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/programm...pt/gr/column3/

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •