473,785 Members | 2,987 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

innerHTML and images loading

Dear All,

I have a little strange problem with using innerHTML property to
update my browser document.
The HTML content I am inserting in document contains images. These
images are to be downloaded from the web.
Well, they are downloaded and everything works, BUT:

on relatively small network, I can see how these images are loaded one
by one, as if requests for these images were sent sequentuially. This
does not happens if I get the same content in "common" way (not using
innerHTML).

Have anybody seen this effect ?

I had a kind of hypothesis about it. Maybe setting innerHTML through
javascript (which is what I am doing) works in a signle thread, and
this is a reason why requests are sent sequnetially ?

Thanks & Regards,

Nick
Jul 20 '05 #1
1 6935
Ivo
Not sure what the problem is. Do you want all images to be there at
the same time? Preload them. That is: tell the browser you are going
to need image This and image That, and it will download and cache
them, so that they are instantly displayed the moment you set your
innerHTML.

You tell the browser to cache an image with something like:
var ima= new Image(); var ge=new Image();
ima.src="This.g if"; ge.scr="That.jp g";

or a function that takes an arbitrary number of files (you can also
preload css and script files or other pages) as its arguments:
function preload(n){
for(i=0;i<argum ents.length;i++ ){
x=new Image();x.src=a rguments[i];
}
}
preload("This.g if","That.jpg") ;

If something else is the problem, disregard this post.:)
I believe every browser has an x number of ports or threads to
download a page and its associate files. The more pages I request at
once, the more apparent the sequential loading is.
HTH
Ivo

ni**********@ya hoo.com (nick) wrote in message news:<83******* *************** ****@posting.go ogle.com>...
Dear All,

I have a little strange problem with using innerHTML property to
update my browser document. The HTML content I am inserting in document contains images. These
on relatively small network, I can see how these images are loaded one
by one, as if requests for these images were sent sequentuially. This
does not happens if I get the same content in "common" way (not using
innerHTML).

Have anybody seen this effect ?

I had a kind of hypothesis about it. Maybe setting innerHTML through
javascript (which is what I am doing) works in a signle thread, and
this is a reason why requests are sent sequnetially ?

Thanks & Regards,

Nick

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
8915
by: JimMenees | last post by:
(code is at end of post) ------------------------------------------- I'm using an i-frame to grab a server-side text file and display its content elsewhere in the html document. On change of the i-frame source, I want to access its innerHTML. The i-frame source changes just fine and even displays the source; the glitch is in accessing the innerHTML for that new i-frame src file. It requires *TWO* clicks of the onClick element to get...
7
6594
by: Frostillicus | last post by:
Hi, I've written some javascript to randomly choose a classical music composer's picture and sample audio and display it on my home page (http://marc.fearby.com/), and this works fine in Mozilla but has problems in IE. Here's the code: imagestring = "<img src=\"" + imagedir + composers + "\" />"; objimage.innerHTML = imagestring;
1
14369
by: Izzet Pembeci | last post by:
I am trying to display some rss feeds in my homepage. To do that I am using an external script which returns smth like: document.writeln("<div ...>") document.writeln("Title of News 1") !! read from the feed ..... document.writeln("</div>") So displaying just one feed is a matter of adding the line: <script language=Javascript src="http....?rssfeed=somefeed.xml"> </script>
1
2027
by: mboso | last post by:
I have a function that works in firefox, but is having some issues in IE. What it does is place an image in a specified cell, when an icon in the adjacent cell is clicked. I have to click the link half a dozen times for the full size image to load in the adjacent cell. It appears to load %20 of the image then stops. In firefox, I click once and it works. any ideas? Here is the offending code, and well at the HTML. I don't know if it...
4
1621
by: VR | last post by:
Hi, I am trying to have a menu item (which is an HTML img) to change as a mouse moves over it. So, my code looks something like this: <a onmouseover="ActivateImage('MyImage');" onmouseout="InactivateImage('MyImage');" href="javascript:void(FollowLink('MyImage'));">
6
8316
by: snazzy | last post by:
I have a problem where using innerHTML to rewrite a DIV or removeChild to kill a DIV that either of them, if excuted before the page is done loading will stop the page in its tracks. removeChild: http://www.jsonline.com/preview/richmedia6.asp The innerHTML rewrite acts the same way. If you click "close ad" in the upper right corner before the page has loaded completely then the page will stop loading and elements could be missing.
3
9513
by: littleark | last post by:
Hi everybody, I have a typical javascript images preloader, it works fine both on Firefox and on IE in my intranet (local server). It works fine on the Internet (remote server) in IE. In Firefox it stops before loading every image. Does image.onload function have some problems with little images?
0
2205
by: speedcoder | last post by:
hi all, i'm stumped. my applet used to load images over the network. (it was actually designed by someone else.) yes, the applet used to load each image file independently over the network and incurred a network hit per image file. i wanted to avoid the overhead of a separate network connection for each image file, so i bundled all the images into the JAR file. yet, somehow, the loading time for the applet is slower now! i'm totally...
3
1826
by: zero0x | last post by:
hi all, i'm trying to create something like window in javascript. there is no problem in firefox, but in microsoft internet explorer i get "Unknown error while working" (this message is in slovak language, and i has translated it, so maybe in english version it differs). when i comment this line: tab.innerHTML="test";
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10327
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10151
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10092
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8973
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.