473,406 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Problem in loading images that contained in div. IE6 vs Firefox

hello all,

i'm a newbie in ajax. now i work in team that developed an online map site which is similar like google map.

we use <div> to contain the map.
This div contains map image tiles and this map can be dragged like google map,
when we drag this map, the map will request images with ajax.
At this point, both in IE 6 an firefox has no problem to load the map image tiles.

After that, we want to create icons that can be clicked,
each of the icons is contained in a div with unique id.
If we generated just few icons and we dragg the map,
both in IE6 and firefox will have the same fast respond in loading the map tile.
but after we generate more than 10 icons, firefox is faster than IE6 in loading the map tile.

With that number of icons, firefox is about 3 times faster than IE.
IE needs about 2-3 seconds to load the images after we dragged the map.

Can anyone give explanation about what we experience now?
Does IE have a different behaviour than mozilla in loading the images,
especially when it has many div that contain icon (maybe about 20-50 div that contain icon)
Sep 21 '07 #1
2 1749
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

Post some sample code or a link.
Sep 21 '07 #2
sorry,im also a newbie in this forum, i didn't know that i had to post my code.

well,here they are..
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2. function drawIcons(x,y,icon)
  3. {
  4.     var point = new GLatLng(x, y);
  5.     var mark = new createIcons(point, icon); <!--###### this is where i generate the icon that contained in divs -->
  6.     map.addOverlay(mark);
  7. }
  8.  
  9. function defIcon(icon_path)
  10. {
  11.     if (icon_path!="")
  12.     { 
  13.         var icon = new GenIcon();
  14.         icon.setSrc(icon_path);
  15.         return icon;
  16.     }
  17. }
  18.  
  19. function GenIcon() {
  20.     var tImg = new Image();
  21.     this.setSrc = function(xsrc) {
  22.         this.src = xsrc;
  23.         tImg.src = xsrc;
  24.     }
  25.     this.size = new GSize(tImg.width, tImg.height);
  26. }
  27.  
  28. function GenSize(w, h) {
  29.     this.width = w;
  30.     this.height = h;
  31. }
  32.  
  33. function createIcons(point, icon) {
  34.     this.icon = icon;
  35.     if (icon==null) this.icon = new GIcon();
  36.  
  37.     if (typeof this.points.length == 'undefined')    {
  38.         Map.icon.push(this.points);
  39.         Map.icon.push(this.icon);
  40.         content = new setIcon(this.icon.src, this.points.vx, this.points.vy, this.icon.size.width, this.icon.size.height); <!--###### this is the code that i begin to set the icon -->
  41.     } else {
  42.         content = new Array(this.points.length);
  43.         for (var i=0; i<this.points.length; i++)    {
  44.             Map.icon.push(this.points[i]);
  45.             Map.icon.push(this.icon);
  46.             content[i] = new setIcon(this.icon.src, this.points[i].vx, this.points[i].vy, this.icon.size.width, this.icon.size.height);
  47.         }
  48.     }        
  49. function setIcon(urlImage, x, y, width, height) {
  50.     var tempXY = new GLatLng(Map.currentX, Map.currentY);
  51.     if (typeof Map.icon.length != 'undefined')    {
  52.         var divLegend = new createDiv("xicon"+((Map.icon.length/2)-1)); <!--###### this is where the div were created -->
  53.  
  54.         divLegend.setXY(x, y);
  55.         divLegend.setSize(width, height);
  56.         var img = new Image();
  57.         img.src = urlImage;
  58.         divLegend.append(img); <!--#######this is where the image or icon was appended into the div -->
  59.         return divLegend.div;
  60.     }
  61. }
  62. function createDiv(id) {
  63.     var id;
  64.     this.div = document.createElement("div");
  65.     this.id = id;
  66.     this.div.setAttribute("id", id);
  67.     this.setXY = function(x,y) {
  68.         this.div.style.left = x+"px";
  69.         this.div.style.top = y+"px";
  70.     };
  71. }
  72. <?php
  73. function generateStationsIcon($arr)
  74. {
  75.     $icons = "";
  76.     for($i=0;$i<count($arr);$i++)
  77. //        for($i=0;$i<1;$i++)
  78.     {
  79.             $x = $arr[$i]["x_addr"];
  80.             $y = $arr[$i]["y_addr"];
  81.             $desc = "";
  82.             $icons .= 'icons'.$i.' = defIcon("'.$this->map_images_path.'icon1.gif"); ';
  83.             $icons .= 'drawIcons('.$x.','.$y.',icons'.$i.'"); ';
  84.     }
  85.     return $icons;
  86. }
  87.  
  88. if(trim($stations_attr)!="")
  89. {
  90.     echo $this->generateStationsIcon($stations_attr);
  91. }    
  92. ?>
  93. </script>
  94.  
is this enough?

-cheers- :D
Sep 24 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: VR | last post by:
First, greetings to everyone :) I'm doing a university seminar & I've encountered a problem. I have a gallery with thumbnails linked on pictures. What I want is popup to be opened with...
7
by: chris | last post by:
Firefox seems to be restricting JavaScript image loading. The following code works fine in all browsers except Firefox: function loadImage() { var objIcon = document.createElement( 'IMG' );...
1
by: books1999 | last post by:
Hi there, I have a problem with this css/div and i cannot work it out. I would like either container to be able to push the background box to grow but in Firefox it overflows. Can someone find a...
4
by: Dan | last post by:
I'm using asp.net c# in my code behind I coded the following: ButtonAsynchronous.Attributes.Add("onclick", @" setTimeout( ""UpdateImg('AnimatedProgress','images/running.gif');"" , 50); "); ...
27
by: Chris Tomlinson | last post by:
Hi, is there any way to specify the sequence in which images load on a web page? More specifically, here is what we need to achieve: Image1 starts loading first and the browser does not...
6
by: Ivan Bútora | last post by:
I have recently looked at http://alistapart.com/articles/imagegallery to implement a simple picture gallery on a webpage that I'm working on. Everything works fine; however, I have one question....
1
by: agatha.life | last post by:
I did a javascript for the loading of images (I didn't want to have the images loaded in "on loading" because they are too many). The website is for a model and if you look at the codeof pages (...
1
by: sirjaybishop | last post by:
Hi I have an issue in some browsers when linking to style sheets or images in some browsers using a DOM script after I have submitted a form. I am trying to make the form submission process...
1
by: innivive | last post by:
I am having a problem with having margins display correctly in IE7, Firefox and Safari. I am not sure if it is the "double margin error" or something else. Any help would be appreciated. The file...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.