473,466 Members | 1,395 Online
Bytes | Software Development & Data Engineering Community
Create 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_preloadImages(
'<%=assets_path%>/left_nav/manage_view_wthr_on.gif',
'<%=assets_path%>/left_nav/manage_admin_guide_on.gif',
'<%=assets_path%>/left_nav/manage_terms_cond_on.gif',
'<%=assets_path%>/left_nav/manage_reports_on.gif',
'<%=assets_path%>/left_nav/manage_account_info_on.gif',
)
function gn_rollover_preload(){
//preloads middle images for the navigation
if (document.images){
var argLength = gn_rollover_preload.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_HEADER +
"button_nav_"+ arguments[arg] + "_off.gif'");
eval(arguments[arg] + "_on.src = '" + ASSET_PATH_HEADER +
"button_nav_"+ arguments[arg] + "_on.gif'");
eval(arguments[arg] + "_left.src = '" + ASSET_PATH_HEADER +
"button_nav_"+ arguments[arg] + "_left.gif'");
eval(arguments[arg] + "_right.src = '" + ASSET_PATH_HEADER +
"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_HEADER +
"button_nav_corner_1.gif'");
corner2.src = eval("'" + ASSET_PATH_HEADER +
"button_nav_corner_2.gif'");
corner2_both.src = eval("'" + ASSET_PATH_HEADER +
"button_nav_corner2_both.gif'");
corner3.src = eval("'" + ASSET_PATH_HEADER +
"button_nav_corner_1.gif'");
corner3_both.src = eval("'" + ASSET_PATH_HEADER +
"button_nav_corner3_both.gif'");
corner4.src = eval("'" + ASSET_PATH_HEADER +
"button_nav_corner_1.gif'");
corner4_both.src = eval("'" + ASSET_PATH_HEADER +
"button_nav_corner4_both.gif'");
corner5.src = eval("'" + ASSET_PATH_HEADER +
"button_nav_corner_2.gif'");

}
}
Jul 20 '05 #1
2 2937
Ju*********@graduates.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_preloadImages(
'<%=assets_path%>/left_nav/manage_view_wthr_on.gif',
'<%=assets_path%>/left_nav/manage_admin_guide_on.gif',
'<%=assets_path%>/left_nav/manage_terms_cond_on.gif',
'<%=assets_path%>/left_nav/manage_reports_on.gif',
'<%=assets_path%>/left_nav/manage_account_info_on.gif',
)
function gn_rollover_preload(){
//preloads middle images for the navigation
if (document.images){
var argLength = gn_rollover_preload.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_HEADER +
"button_nav_"+ arguments[arg] + "_off.gif'");
eval(arguments[arg] + "_on.src = '" + ASSET_PATH_HEADER +
"button_nav_"+ arguments[arg] + "_on.gif'");
eval(arguments[arg] + "_left.src = '" + ASSET_PATH_HEADER +
"button_nav_"+ arguments[arg] + "_left.gif'");
eval(arguments[arg] + "_right.src = '" + ASSET_PATH_HEADER +
"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_HEADER
+
"button_nav_"+ arguments[arg] + "_off.gif";
preloadedImgs[arguments[arg] + "_on"].src = ASSET_PATH_HEADER
+
"button_nav_"+ arguments[arg] + "_on.gif";
preloadedImgs[arguments[arg] + "_left"].src =
ASSET_PATH_HEADER +
"button_nav_"+ arguments[arg] + "_left.gif";
preloadedImgs[arguments[arg] + "_right"].src =
ASSET_PATH_HEADER +
"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_HEADER +
"button_nav_corner_1.gif'");
corner2.src = eval("'" + ASSET_PATH_HEADER +
"button_nav_corner_2.gif'");
corner2_both.src = eval("'" + ASSET_PATH_HEADER +
"button_nav_corner2_both.gif'");
corner3.src = eval("'" + ASSET_PATH_HEADER +
"button_nav_corner_1.gif'");
corner3_both.src = eval("'" + ASSET_PATH_HEADER +
"button_nav_corner3_both.gif'");
corner4.src = eval("'" + ASSET_PATH_HEADER +
"button_nav_corner_1.gif'");
corner4_both.src = eval("'" + ASSET_PATH_HEADER +
"button_nav_corner4_both.gif'");
corner5.src = eval("'" + ASSET_PATH_HEADER +
"button_nav_corner_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('Image2','','/left_nav/manage_view_state_on.gi
f',0)" >

function MM_swapImage() {
var i,j=0,x,a=MM_swapImage.arguments;
document.MM_sr=new Array;
for(i=0;i<(a.length-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_swapImgRestore() {
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_preloadImages() {
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; 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
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...
7
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...
3
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...
2
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...
4
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...
4
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...
9
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 ... -...
4
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...
1
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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...
0
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...
0
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...
0
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 ...

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.