473,657 Members | 2,678 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

slow preload for IE

Has anyone else had this issue? Basically, the preload of images for a
rollover effect for the navigation is really really slow when using IE
6.0 but when i view the site using Netscape, it's fast like it should
be(no lag!)

My problem is that since 96% of users use IE, i need to figure a way
to fix this. Below is the javascript currently being used. The
arguments are passed in before the script is called.

MM_preloadImage s(
'<%=assets_path %>/left_nav/manage_view_wth r_on.gif',
'<%=assets_path %>/left_nav/manage_admin_gu ide_on.gif',
'<%=assets_path %>/left_nav/manage_terms_co nd_on.gif',
'<%=assets_path %>/left_nav/manage_reports_ on.gif',
'<%=assets_path %>/left_nav/manage_account_ info_on.gif',
)
function gn_rollover_pre load(){
//preloads middle images for the navigation
if (document.image s){
var argLength = gn_rollover_pre load.arguments. length;

for (arg=0; arg < argLength; arg++){
eval(arguments[arg] + "_off = new Image()");
eval(arguments[arg] + "_on = new Image()");
eval(arguments[arg] + "_left = new Image()");
eval(arguments[arg] + "_right = new Image()");

eval(arguments[arg] + "_off.src = '" + ASSET_PATH_HEAD ER +
"button_nav _"+ arguments[arg] + "_off.gif'" );
eval(arguments[arg] + "_on.src = '" + ASSET_PATH_HEAD ER +
"button_nav _"+ arguments[arg] + "_on.gif'") ;
eval(arguments[arg] + "_left.src = '" + ASSET_PATH_HEAD ER +
"button_nav _"+ arguments[arg] + "_left.gif' ");
eval(arguments[arg] + "_right.src = '" + ASSET_PATH_HEAD ER +
"button_nav _"+ arguments[arg] + "_right.gif '");
}

// Now Preload all "corner" images for faster swapping
corner1 = new Image();
corner2 = new Image();
corner2_both = new Image();
corner3 = new Image();
corner3_both = new Image();
corner4 = new Image();
corner4_both = new Image();
corner5 = new Image();

corner1.src = eval("'" + ASSET_PATH_HEAD ER +
"button_nav_cor ner_1.gif'");
corner2.src = eval("'" + ASSET_PATH_HEAD ER +
"button_nav_cor ner_2.gif'");
corner2_both.sr c = eval("'" + ASSET_PATH_HEAD ER +
"button_nav_cor ner2_both.gif'" );
corner3.src = eval("'" + ASSET_PATH_HEAD ER +
"button_nav_cor ner_1.gif'");
corner3_both.sr c = eval("'" + ASSET_PATH_HEAD ER +
"button_nav_cor ner3_both.gif'" );
corner4.src = eval("'" + ASSET_PATH_HEAD ER +
"button_nav_cor ner_1.gif'");
corner4_both.sr c = eval("'" + ASSET_PATH_HEAD ER +
"button_nav_cor ner4_both.gif'" );
corner5.src = eval("'" + ASSET_PATH_HEAD ER +
"button_nav_cor ner_2.gif'");

}
}
Jul 20 '05 #1
2 2956
Ju*********@gra duates.iti.com (jmhill) wrote:
Has anyone else had this issue? Basically, the preload of images for a
rollover effect for the navigation is really really slow when using IE
6.0 but when i view the site using Netscape, it's fast like it should
be(no lag!)

My problem is that since 96% of users use IE, i need to figure a way
to fix this. Below is the javascript currently being used. The
arguments are passed in before the script is called.

MM_preloadImag es(
'<%=assets_pat h%>/left_nav/manage_view_wth r_on.gif',
'<%=assets_pat h%>/left_nav/manage_admin_gu ide_on.gif',
'<%=assets_pat h%>/left_nav/manage_terms_co nd_on.gif',
'<%=assets_pat h%>/left_nav/manage_reports_ on.gif',
'<%=assets_pat h%>/left_nav/manage_account_ info_on.gif',
)
function gn_rollover_pre load(){
//preloads middle images for the navigation
if (document.image s){
var argLength = gn_rollover_pre load.arguments. length;

for (arg=0; arg < argLength; arg++){
eval(arguments[arg] + "_off = new Image()");
eval(arguments[arg] + "_on = new Image()");
eval(arguments[arg] + "_left = new Image()");
eval(arguments[arg] + "_right = new Image()");

eval(arguments[arg] + "_off.src = '" + ASSET_PATH_HEAD ER +
"button_nav_ "+ arguments[arg] + "_off.gif'" );
eval(arguments[arg] + "_on.src = '" + ASSET_PATH_HEAD ER +
"button_nav_ "+ arguments[arg] + "_on.gif'") ;
eval(arguments[arg] + "_left.src = '" + ASSET_PATH_HEAD ER +
"button_nav_ "+ arguments[arg] + "_left.gif' ");
eval(arguments[arg] + "_right.src = '" + ASSET_PATH_HEAD ER +
"button_nav_ "+ arguments[arg] + "_right.gif '");
}
Don't use eval. It's slow an error prone. I've seen only 2 cases
where eval was required and everything else can be written better a
different way.

var preloadedImgs = new Object();
for (arg=0; arg < argLength; arg++)
{
preloadedImgs[arguments[arg] + "_off"] = new Image()";
preloadedImgs[arguments[arg] + "_on"] = new Image()";
preloadedImgs[arguments[arg] + "_left"] = new Image()";
preloadedImgs[arguments[arg] + "_right"] = new Image()";

preloadedImgs[arguments[arg] + "_off"].src = ASSET_PATH_HEAD ER
+
"button_nav _"+ arguments[arg] + "_off.gif";
preloadedImgs[arguments[arg] + "_on"].src = ASSET_PATH_HEAD ER
+
"button_nav _"+ arguments[arg] + "_on.gif";
preloadedImgs[arguments[arg] + "_left"].src =
ASSET_PATH_HEAD ER +
"button_nav _"+ arguments[arg] + "_left.gif" ;
preloadedImgs[arguments[arg] + "_right"].src =
ASSET_PATH_HEAD ER +
"button_nav _"+ arguments[arg] + "_right.gif ";
}

// Now Preload all "corner" images for faster swapping
corner1 = new Image();
corner2 = new Image();
corner2_both = new Image();
corner3 = new Image();
corner3_both = new Image();
corner4 = new Image();
corner4_both = new Image();
corner5 = new Image();

corner1.src = eval("'" + ASSET_PATH_HEAD ER +
"button_nav_co rner_1.gif'");
corner2.src = eval("'" + ASSET_PATH_HEAD ER +
"button_nav_co rner_2.gif'");
corner2_both.sr c = eval("'" + ASSET_PATH_HEAD ER +
"button_nav_co rner2_both.gif' ");
corner3.src = eval("'" + ASSET_PATH_HEAD ER +
"button_nav_co rner_1.gif'");
corner3_both.sr c = eval("'" + ASSET_PATH_HEAD ER +
"button_nav_co rner3_both.gif' ");
corner4.src = eval("'" + ASSET_PATH_HEAD ER +
"button_nav_co rner_1.gif'");
corner4_both.sr c = eval("'" + ASSET_PATH_HEAD ER +
"button_nav_co rner4_both.gif' ");
corner5.src = eval("'" + ASSET_PATH_HEAD ER +
"button_nav_co rner_2.gif'");


Get rid of eval. It does absolutely nothing here but slow you down.
http://msdn.microsoft.com/library/en...6jsmtheval.asp

Regards,
Steve
Jul 20 '05 #2

Thanks for the input Steve. After doing a little deeper digging I'm
guessing that the problem is a little deeper than the preload. Since the
lag time appears on the rollover effects of the images, it appears the
javascript functions for the onMouseOver and onMouseOut may be to blame.
Take a look at these functions and let me know if anything seems wierd
that might cause the lag in IE but not Netscape.

Thanks

onMouseOver="MM _swapImage('Ima ge2','','/left_nav/manage_view_sta te_on.gi
f',0)" >

function MM_swapImage() {
var i,j=0,x,a=MM_sw apImage.argumen ts;
document.MM_sr= new Array;
for(i=0;i<(a.le ngth-2);i+=3){
if ((x=MM_findObj( a[i]))!=null){
document.MM_sr[j++]=x;
if(!x.oSrc){
x.oSrc=x.src;
}
x.src=a[i+2];
}
}
}

onMouseOut="MM_ swapImgRestore( )"

function MM_swapImgResto re() {
var i,x,a=document. MM_sr;
for(i=0;a&&i< a.length&&(x=a[i])&&x.oSrc;i++ ){
x.src=x.oSrc;
}
}

And if that wasn't enough, here's the real preload that gets called:

function MM_preloadImage s() {
var d=document;
if(d.images){
if(!d.MM_p){
d.MM_p=new Array();
}
var i,j=d.MM_p.leng th,a=MM_preload Images.argument s;
for(i=0; i< a.length; i++){
if (a[i].indexOf("#")!= 0){
d.MM_p[j]=new Image;
d.MM_p[j++].src=a[i];
}
}
}
}

Thanks for any help

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3

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

Similar topics

2
3665
by: Tole | last post by:
hi all, i've got a selcetbox (multiple) which is filled by javascript. only problem is that i have aprox 1000 options to add to that select, and that adding lasts for 5-6 seconds. Even select.length = 0 (on filled element) lasts for few seconds. ok. i have large amount of data to preload, and i also do some operations on that data, but it's all very fast. so i thought it must be some IE rendering issue, and i tried to set...
7
3648
by: MALdito | last post by:
hi everybody let me say right from the start .. I´m not a coder ... "just" a designer! that said .. here is my question: I´m using dreamweaver´s built in preloader for a menu. it looks like this: function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
3
1798
by: Max Biancofiore | last post by:
I am working on a website. Can everybody have a look at www.intheloop.org.uk/sw5/index.html and tell me: 1) How long do the buttons take to download. (state connection speed too). 2) How do the rollover work. Especially concerning the image preload. I am writing this because, I don't know why, on my Pc this site works
2
3380
by: Albert Spencil | last post by:
I have tried several preload scripts found here; plus, some of my own. The only thing that works is the unsophisticated loading of those tiny images. The download consist of 100+ images amounting to 50+mb; and, normally completes in less than 1 minute without preload (using DSL). The preload terminates after 6 or 7 images and seems to time-out in the middle of an image. A reload will download a few more, etc. I have used the <body...
4
3736
by: Adrian MacNair | last post by:
Hi, I created an image gallery which displays 63 images in a slideshow. The problem is that the show was slow because each image loaded one at a time during the show. No problem right? I just did a preload script. But then the user has to sit for 5 minutes waiting for 63 images to download! My images are about 640x480 and average 100kb. Is this too much for one page to load? Should I load my slideshow into differerent windows? If so,...
4
9906
by: Scott Johnson | last post by:
Hi! Is there a way to "preload" a form using a thread or something else so that my user doesn't have to wait 5 seconds (initializing time) between forms? Some of these forms have tab strips with lots of controls and database queries on them and I would like to try to have some(all) of the preloading of the next form and controls done in the background while a user is still entering data. (For example, my user visits screen A then B then...
9
2974
by: jeff | last post by:
Hi All. I realize that when my Deployed winforms application starts, Windows needs to load the .net 2 framework before control is given to my application.... Is there anyway to either ... - preload the .net 2 framework (windows startup or whatever) - splash a screen ... application loading ... please wait ... type of
4
6590
by: rubyhcurry | last post by:
Hello, I have a small application which acts like a wizard with 5 steps. I use a tab control, and 'back' and 'next' buttons to switch between the 5 tabs (1 tab page for each step). The components on each tab are very light (mostly labels and input fields) and my C# code (the actual program logic) is well optimized. I also use multi threading to separate the UI from the core of the app. The rendering of the each tab page when I click...
1
2374
by: shapper | last post by:
Hello, Is there a way to preload a few images of a page using only CSS? If yes, how can I do it, and should I use CSS or Javascript to do this? Thanks, Miguel
0
8403
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
8316
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8833
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...
1
8509
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
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4168
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
2735
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
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
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.