Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Almost driven to tears...please help

Status
Not open for further replies.

Cadwalader

IS-IT--Management
Feb 12, 2002
297
US
Please help, I got a nasty letter on my desk thismorning from the boss about a rollover script that I used on one of his sites. It runs slower than molassas in January, going uphill in the snow, thanks to IE6. Unfortunately, 99.2% of all the hits on this website are IE5.5 and 6. So I have to make it work right.

I've dug around on the Internet this morning and found that IE is hitting the server everytime you run the mouse over one of the images. I know it works fine for you folks lucky enough to have a Pentuim4, but for the 500MHz CPU's in this office, it's not working. I also red that IE6 parses everything everytime something is called, or needed, or changed...or something like that.. So anyway, I looked for an alternative script in tek-tips, and several other js sites, but I am so confused, there is smoke coming out of my ears now.

Ok, in a nutshell, I need to make this script stop IE from getting the pics from the server all the time, and use the cache. Is there a way to do that?

If not, is there another type of script I could use? I am week with JavaScript.

I despratlely need help. I am getting the distinct feeling that if I can't fix this today, I won't have a job tomorrow. here is the code.

<html>
<head>
<title>Pharmacy Care Specialists - (800) 350-2325</title>


<script LANGUAGE=&quot;JavaScript&quot;>
ap=&quot;'&quot;;
loaded=true;
if (document.images){
var tb1_d = new Image(100,29);
tb1_d.src = &quot;images/hometab.gif&quot;;
var tb2_d = new Image(100,29);
tb2_d.src = &quot;images/aboutustab.gif&quot;;
var tb3_d = new Image(100,29);
tb3_d.src = &quot;images/alftab.gif&quot;;
var tb4_d = new Image(100,29);
tb4_d.src = &quot;images/womentab.gif&quot;;
var tb5_d = new Image(100,29);
tb5_d.src = &quot;images/mentab.gif&quot;;
var tb6_d = new Image(100,29);
tb6_d.src = &quot;images/faq.gif&quot;;
var tb7_d = new Image(100,29);
tb7_d.src = &quot;images/contactustab.gif&quot;;
var CId = new Image(700,21);
CId.src = &quot;images/alfbar.gif&quot;;
var tb1_ = new Image(100,29);
var tb1_h = new Image(100,29);
tb1_h.src = &quot;images/hometab.gif&quot;;
var CI1_h = new Image(700,21);
CI1_h.src = &quot;images/bar.gif&quot;;
var tb2_ = new Image(100,29);
var tb2_h = new Image(100,29);
tb2_h.src = &quot;images/aboutustab.gif&quot;;
var CI2_h = new Image(700,21);
CI2_h.src = &quot;images/aboutusbar.gif&quot;;
var tb3_ = new Image(100,29);
var tb3_h = new Image(100,29);
tb3_h.src = &quot;images/alftab.gif&quot;;
var CI3_h = new Image(700,21);
CI3_h.src = &quot;images/alfbar.gif&quot;;
var tb4_ = new Image(100,29);
var tb4_h = new Image(100,29);
tb4_h.src = &quot;images/womentab.gif&quot;;
var CI4_h = new Image(700,21);
CI4_h.src = &quot;images/womenbar.gif&quot;;
var tb5_ = new Image(100,29);
var tb5_h = new Image(100,29);
tb5_h.src = &quot;images/mentab.gif&quot;;
var CI5_h = new Image(700,21);
CI5_h.src = &quot;images/mensbar.gif&quot;;
var tb6_ = new Image(100,29);
var tb6_h = new Image(100,29);
tb6_h.src = &quot;images/faq.gif&quot;;
var CI6_h = new Image(700,21);
CI6_h.src = &quot;images/faqbar.gif&quot;;
var tb7_ = new Image(100,29);
var tb7_h = new Image(100,29);
tb7_h.src = &quot;images/contactustab.gif&quot;;
var CI7_h = new Image(700,21);
CI7_h.src = &quot;images/contactbar.gif&quot;;
}
tb1_m = 'Welcome to PCS!';
tb2_m = 'About PCS';
tb3_m = 'ALF Services';
tb4_m = 'Growth Hormones';
tb5_m = 'Compounding Services';
tb6_m = 'Frequently Asked Questions';
tb7_m = 'Contact Us';
dm = &quot;Document Done.&quot;;
function cb(){if(document.images&&loaded){return true}else{return false}}
</script>
<link rel=&quot;stylesheet&quot; href=&quot;style.css&quot; type=&quot;text/css&quot;>
</head>

<body bgcolor=&quot;#ffffff&quot; text=&quot;#000000&quot; link=&quot;#0033CC&quot; vlink=&quot;#0033CC&quot; alink=&quot;#0033CC&quot; leftmargin=&quot;10&quot;>
<img src=&quot;images/logohead.gif&quot; ><br>
<h1>Specializing in unit dose dispensing sytems for adult living facilities.</h1>
<table width=&quot;700px&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;><tr><td>

<table width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tbody>
<tr>
<td><center>
<a href=&quot; target=&quot;_self&quot; onmouseover=&quot;if(cb()){tb1_.src=tb1_h.src;CI.src=CI1_h.src;}window.status=tb1_m;return true&quot; onmouseout=&quot;if(cb()){tb1_.src=tb1_d.src;CI.src=CId.src;}return true;&quot;><img src=&quot;images/hometab.gif&quot; alt=&quot;...&quot; border=&quot;0&quot; width=&quot;100&quot; height=&quot;29&quot; name=&quot;tb1_&quot;></a><a href=&quot; onmouseover=&quot;if(cb()){tb2_.src=tb2_h.src;CI.src=CI2_h.src;}window.status=tb2_m;return true&quot; onmouseout=&quot;if(cb()){tb2_.src=tb2_d.src;CI.src=CId.src;}return true;&quot;><img src=&quot;images/aboutustab.gif&quot; alt=&quot;...&quot; border=&quot;0&quot; width=&quot;100&quot; height=&quot;29&quot; name=&quot;tb2_&quot;></a><a href=&quot; target=&quot;_self&quot;onmouseover=&quot;if(cb()){tb3_.src=tb3_h.src;CI.src=CI3_h.src;}window.status=tb3_m;return true&quot; onmouseout=&quot;if(cb()){tb3_.src=tb3_d.src;CI.src=CId.src;}return true;&quot;><img src=&quot;images/alftab.gif&quot; alt=&quot;...&quot; border=&quot;0&quot; width=&quot;100&quot; height=&quot;29&quot; name=&quot;tb3_&quot;></a><a href=&quot; target=&quot;_self&quot; onmouseover=&quot;if(cb()){tb4_.src=tb4_h.src;CI.src=CI4_h.src;}window.status=tb4_m;return true&quot;onmouseout=&quot;if(cb()){tb4_.src=tb4_d.src;CI.src=CId.src;}return true;&quot;><img src=&quot;images/womentab.gif&quot; alt=&quot;...&quot; border=&quot;0&quot; width=&quot;100&quot; height=&quot;29&quot; name=&quot;tb4_&quot;></a><a href=&quot; target=&quot;_self&quot; onmouseover=&quot;if(cb()){tb5_.src=tb5_h.src;CI.src=CI5_h.src;}window.status=tb5_m;return true&quot; onmouseout=&quot;if(cb()){tb5_.src=tb5_d.src;CI.src=CId.src;}return true;&quot;><img src=&quot;images/mentab.gif&quot; alt=&quot;...&quot; border=&quot;0&quot; width=&quot;100&quot; height=&quot;29&quot; name=&quot;tb5_&quot;></a><a href=&quot; target=&quot;_self&quot; onmouseover=&quot;if(cb()){tb6_.src=tb6_h.src;CI.src=CI6_h.src;}window.status=tb6_m;return true&quot; onmouseout=&quot;if(cb()){tb6_.src=tb6_d.src;CI.src=CId.src;}return true;&quot;><img src=&quot;images/faq.gif&quot; alt=&quot;...&quot; border=&quot;0&quot; width=&quot;100&quot; height=&quot;29&quot; name=&quot;tb6_&quot;></a><a href=&quot; target=&quot;_self&quot; onmouseover=&quot;if(cb()){tb7_.src=tb7_h.src;CI.src=CI7_h.src;}window.status=tb7_m;return true&quot; onmouseout=&quot;if(cb()){tb7_.src=tb7_d.src;CI.src=CId.src;}return true;&quot;><img src=&quot;images/contactustab.gif&quot; alt=&quot;...&quot; border=&quot;0&quot; width=&quot;100&quot; height=&quot;29&quot; name=&quot;tb7_&quot;></a></center></td>
</tr>
<tr>
<td><center><img src=&quot;images/alfbar.gif&quot; alt=&quot;...&quot; width=&quot;700&quot; height=&quot;21&quot; name=&quot;CI&quot;></center></td>
</tr>
</tbody>
</table>

....and the rest is regular old HTML.....


The url to the live pages is menshealth.ws if you want to see what the heck is going on or copy the images for testing, or to laugh at how corny it looks (it's look and feel was not my idea, and I didn't have any say in it)...Thank you so much in advance...man, I am up to my neck in it today... [bugeyed] Hope I was of some help...
--OR--
Thanks for the help...
--Rich
 

i will help...

please explain in steps what is happening now, and then what you need to happen a little more clearly.

thanks.

 
Thank you soooo much...here goes...

OK, the core of the problem is that the image swapping is going way too slow in IE. It runs like a champ in NN and Mozilla.

In IE6 and IE5.5
When the mouse passes over the tabs, the bar below the tabs doesn't change until the ALT tags show up.

In NN 7 and Mozilla:
The images swapping runs great. I can run the mouse over the tabs as fast as I can, and it literally blurs the bar below the tabs (because the images are changing that fast, like they are supposed to).

I need IE6 to be able to produce the same results as NN and Mozilla. I have been messing with this delemma for almost 2 weeks now. I am week in JS, but I have been studying as much as I can, but obviuously not enough.

I also read that IE is parsing everything and hitting the server for the images with some types of js rollovers--&quot;squirrely&quot; is how they put it. In the same article, the writer also saud you can prove it by putting a page on a floppy disk and fire the rollover and you'd be able to watch teh drive being accessed eveytime the js called for a new image. I haven't had the time to try this, but I will when I get home--I got to see this for myself.

Another thing IE is doing: Whene I click on the images (to go to another page) half of the images dissapear. It seems to be random also. It looks like garbage, I know it's...well, not very well color-coordinated, but that is what the boss wanted.

spewn, thank you sooooo sooo much. If you need anything as far as images, and the code (wich is used as an external file on the live site) feel free to use copy them as needed. If you go to menshealth.ws/rolltest.html you can see it in action as it's listed above. Having the script in the page didn't make any difference. NN and Mozilla read the external file just fine, abviously, because it runs like a champ in those browsers.

Again, thank you so much...:) Hope I was of some help...
--OR--
Thanks for the help...
--Rich

 
I put the index page and all of it's images on a floppy disk and viewed it in IE 6. I opened it. The disk ran. then I ran the mouse over one of the tabs, and THE DRIVE STARTED READING AGIAN!!! Why would Micr$oft do this to us?

I did the same exact thing with NN7, and after the page was loaded the first time, it did not go back to the disk for anything.

That article I read this morning was right on the money....Just thought you might want to know... :) Hope I was of some help...
--OR--
Thanks for the help...
--Rich

 
What about preloading the images? Im not sure how to do this yet but Im pretty sure that would help.
 
One option that comes to mind is to put your images in <div> tags positioned on top of each other and show or hide them instead of swapping the image src. Adam
 
Adam101,

that is an idea...a good one at that, but there are quite a few pages I'd have to work on to change the code entireley. If I have to, then I'll just have to.... I am hoping there is a different way to script that external file.

Zeke0238,
they are preloading. That is what is making me pull my hair out, and I got a fro! :) Hope I was of some help...
--OR--
Thanks for the help...
--Rich

 
Cadwalader, hmmm, i'm not sure if you fixed the problem yet or not, but I went to the site and moused over the tabs and the bar below changed right away!! There was no slowness or anything...and i'm running IE6 on a P3 667mhZ computer...
Could it be that the slowness occurs when using a slow connection?? I'm on a cable modem so maybe that's why it was faster...
Hmmm, in any case, take a look at this and see if you can use this: I have not failed; I have merely found 100,000 different ways of not succeding...
 
GUJUm0deL,

I am on a T1. It's not that busy either (although my cable modem at home is faster on download).

For everyone:

Ok, for those who who like to see IE go for images every time you call for one in an image swap, I put it on my dopey little server at home
(I built it so I could learn Linux.) Go there (and hurry, I don't know when or if my IP is going to change) and dowload the zip file. It contains the index page of menshealth.ws and the images for the navbar at the top that I have been fighting with, the .js file that makes that puppy run, and the .css file. There are 4 files total of 110KB zipped and 117KB unzipped (zipped them so that there is only one thing to downlaod). You'll notice that there are a few images missing on the page itself, but including them would just make the .zip bigger, and they have nothing to do with what you'll see. Instructions on what to look for are on the page.

If you prefer not to download from a stranger, you are more than welcome to get all the images and stuff from the live site, and put it all on a disk yourself. I wouldn't be offended. ;-)

Thanks for the help everyone, I really do appreciate it. So if there is no &quot;fix&quot; for this script, what about the old faithful DHTML image swap?
Hope I was of some help...
--OR--
Thanks for the help...
--Rich
 
I hope you have had some success in this matter ... but I do not think you will find you can do anything to fix the problem (unless it is #2).

Your script looks ok. Once an image is pulled from the server it should load from the cache.

I use nothing but MSIE and have never had a problem - but I know what I am doing with it - most people out there do not.

There are only a few reasons why this may be occurring:

1. MSIE at the user's end is set to &quot;reload on every page visit&quot;. There is nothing you can do about this. Some people set their browsers to do this on purpose since it is the only way to get newly updated data from a page that was visited. In corporate settings, it is also the only way to force a company's Proxy server to get the file again instead fo using an old cached version - since many companies have no idea how to configure their proxy servers to do otherwise.

**NOTE: By default MSIE installs with &quot;automatic&quot; cache settings ... I find this doesn't always work properly and they should go back to using &quot;once per session&quot; as the default - but who's gonna tell MS that?

2. Your web server is set to &quot;NO CACHE&quot;, or you have a &quot;NO CACHE&quot; tag in your web page headers somewhere. In this case, because MSIE does interpret Header Commands it will not cache anything on the page.

3. If a company's Proxy Server is set to &quot;NO CACHE&quot; it will pull the data everytime a user asks for it from their company.

4. This doesn't happen too often, but it can: If the ISP providing connectivity keeps switching Ip addresses, or uses a &quot;mask&quot; so all users look like the same IP, then the browser and/or server will get confused and think a new session started - making the browser reload the images. Shaw (cable provider) has this problem - they do not have enough IPs for the userbase, so sometimes the computer (modem)IP gets switched in mid stream!

5. If a user has cookies shut off (now defult in MSIE 6+) then this can cause a page to keep reloading when set to &quot;automatic&quot; cache instead of once per visit, since a sesion is controlled by a cookie on the user's computer. If the cookie is not there then the browser may think it has not visited the page before. Thsi has become such a problem that we have had to stop programming ecommerce sites using cookies to track purchases - we now have to rely on temporay database tables to track orders until they checkout!

I don;t know if anything here helps ... but unless it is #2 and you fix teh problem at your end, then you will probably have to put up with it - or you should have a 1 time popup on your site for MSIE6+ users explaining how they should set there browser to function. We have not done a popup - but do include the information in some of our website's &quot;help&quot; file.

 
PS:

If you think it may be due to #1 (previous post) then make sure your boss's computer us set to &quot;once per session&quot;.

If you do this - at least the problem will go away, from his perspective!


Many programmers and developers set their browsers this way to make sure they see the latest changes - but it also has repercussions!
 
Well,

I went a totally different route with the js. IE5.5 and IE6 are still downlaoding the images everytime the mouseOver calls for one. So I gess I could try the old DHTML thing adn hope that works.

Safari,
Thanks for all the info. The trouble is that the default settings for IE are just what I have here on this machine. It wouldn't be reasonable for me to have instructions on the site on how to set a visitor's browser just to make this script work like it should.

GUJUm0deL,
Thanks for that link. There is a load of stuff on DD that is nice and tight, clean, and FUNCTIONAL!!! ;-)

To all,
Thank you very much for all the help, I sincerely appreciate every bit of it. I only hope that one day I can return the help. So off I go to revert back to 6 year old coding to make a brand new browser work (wow, did you hear the irony in that?)...Thanks again... Hope I was of some help...
--OR--
Thanks for the help...
--Rich

 
Cadwalader, glad I could help...
I have not failed; I have merely found 100,000 different ways of not succeding...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top