473,765 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IE.6 shows blank images sporadically

Hey All,

I am new to javascript and currently coding a site with scripts that
are beyond my level of understanding. The problematic page has
thumbnail images that can be clicked on to zoom in. When clicked, the
preloaded larger image displays in a div layer that gets turned on. The
problem is that ie sometimes does not display the image - the
placeholder just stays blank. The script works fine in firefox and
netscape (haven't tried safari yet). Since I am new to this and this
only happens sporadically, I'm having a lot of trouble identifying the
error or a fix. Also, the src for the images is dynamically created
from the text name that displays below the bags. This is for content
management purposes. Any suggestions you can give would be much
appreciated.

Thanks,

Trent

Here is the link: www.woundedmouse.com/pearson/showroom.html

Here is the pertinent code:

<SCRIPT TYPE="text/javascript">

var nextzoom = 'next'
var prezoom = 'pre'

//Change the name of the bags below. Ex: Replace "Tina 1II" with "Tina
3". Don't forget the quotes.//
var text = new Array (12)
text[0] = "Tina 1II"
text[1] = "Wendy 4F"
text[2] = "Peggy 1T"
text[3] = "Sarah 1E"
text[4] = "Kimberly 4T"
text[5] = "Kimberly 1U"
text[6] = "Kate 1QQ"
text[7] = "Julie 4W"
text[8] = "Julie 1S"
text[9] = "Julie 1J"
text[10] = "Grace 1GG"
text[11] = "Audrey 1SS"

var smbags = new Array (12)

var zoombag = new Array (12)

//displays the text for each bag name
function bagtext(num)
{
return text[num]
}

//splits the name of the bag, appends info, and writes to array
function splitsm(num)
{
for (num=num; num < 12; num++)
{
var x = text[num];
var change = x.toLowerCase() ;
var temp = new Array();
temp = change.split(' ');
var y = 'images/' +temp[0] + temp[1] + '.jpg';
var z = 'images/' +temp[0] + temp[1] + '_zoom.jpg';
smbags[num] = new Image();
smbags[num].src = y;
window.top.smba gs[num] = y;
var zoomtemp = new Array();
zoomtemp[num] = new Image();
zoomtemp[num].src = z;
window.top.zoom bag[num] = z;
}

}

//zoom bag preloader
function preloadzoom(){
for (i=0; i<12;i++)
{
zoombag[i]=new Image();
}
//alert(zoombag);
}

//loads small bags in placeholders once their src is identified
function loadbag(num)
{
for (num=num; num <12; num++)
document['slot' +num].src = smbags[num]
//alert(zoombag);

}

//loads larger zoom image into placeholder
function loadzoom(num)
{
document.zoom.s rc = zoombag[num]
window.top.next zoom = num+1;
window.top.prez oom = num-1;
}

//turns on div layer that contains zoom placeholder
function bagshow()
{
if(document.lay ers){
//thisbrowser="NN 4";
document.bag.vi sibility="visib le";
}
if(document.all ){
//thisbrowser="ie "
document.all.ba g.style.visibil ity="visible";
}
if(!document.al l && document.getEle mentById){
//thisbrowser="NN 6";
document.getEle mentById("bag") .style.visibili ty="visible";

}
}

//turns off div layer that contains zoom placeholder
function baghide()
{
if(document.lay ers){
//thisbrowser="NN 4";
document.bag.vi sibility="hidde n";
}
if(document.all ){
//thisbrowser="ie "
document.all.ba g.style.visibil ity="hidden";
}
if(!document.al l && document.getEle mentById){
//thisbrowser="NN 6";
document.getEle mentById("bag") .style.visibili ty="hidden";

}
}

function newImage(arg) {
if (document.image s) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}

function changeImages() {
if (document.image s && (preloadFlag == true)) {
for (var i=0; i<changeImages. arguments.lengt h; i+=2) {
document[changeImages.ar guments[i]].src =
changeImages.ar guments[i+1];
}
}
}

var preloadFlag = false;
function preloadImages() {
if (document.image s) {
about_over = newImage("image s/about-over.gif");
styles_over = newImage("image s/styles-over.gif");
fabrics_over = newImage("image s/fabrics-over.gif");
contact_over = newImage("image s/contact-over.gif");
preloadFlag = true;
}
}

// -->
</SCRIPT>
<!-- End Preload Script -->
<link rel="stylesheet " type="text/css" href="master.cs s">
</HEAD>
<BODY onload="preload zoom(); splitsm(0); loadbag(0); preloadImages() ; "
BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0
background="ima ges/bck01.gif">
<div id="bag" style="width: 100%; height: 100%; visibility:hidd en;
position:absolu te; left:0px; top:0px" >
<table width="100%" height="100%" valign="middle" >
<tr>
<td>
<div align="center">
<table class="bag" bgcolor="white" width="360" height="490">
<tr height="10" valign="middle" >
<td style="text-align: center" width="165">
<a class="fbags" href="javascrip t:void(0)"
onclick="loadzo om(prezoom);">< Pre</a>
</td>
<td style="text-align: center" width="165">

<a class="fbags" href="javascrip t:void(0)"
onclick="loadzo om(nextzoom);"> Next ></a>
</td>
<td style="text-align: center" width="30">
<a class="fbags" href="javascrip t:void(0)"
onclick="baghid e();">[x]</a></td>
</tr>
<tr height="480">
<td colspan="3" ><img name="zoom" border="0"
src="images/spacer.gif" width="360" height="480">
</td>
</tr>
</table>
</div>
</td>
</tr>
</table></div>

Jul 23 '05 #1
2 1904
I've tried your page in Firefox and IE6 ... Firefox works fine, but in
IE6 some bags don't show up at all in the zoom (particulary the first
6 bags at the top), some bags sometimes show up partly in the zoom
(after some more clicking these bags show up completely) and some bags
always show up completely (particularly the bags at the bottom).

I did find one thing that doesn't look right in your code:

In the splitsm function you preload the smbags images array (works
OK), and you preload the zoomtemp images array (why zoomTEMP and not
zoomBAG?). The preloadzoom function doesn't do any preloading at all
(it just creates an array with empty images)

So, to make it work properly you could:

- change these lines ...
var zoomtemp = new Array();
zoomtemp[num] = new Image();
zoomtemp[num].src = z;
....to
zoombag = new Array();
zoombag[num] = new Image();
zoombag[num].src = z;

- kill the preloadzoom function (it doesn't do anything; don't forget
to remove it from the body onload event too!)

I'm also wondering what these lines should do:
-> window.top.smba gs[num] = y;
-> window.top.zoom bag[num] = z;

As far as I can tell these lines can be safely removed too.

Oh, and there's a small bug in your loadzoom function:

What if somebody zoomed in on the first image and pressed the Prev
link (or zoomed in on the last image and pressed the Next link)?

To avoid these situations change the code as follows:

function loadzoom(num)
{
// check if there is a next image, if not use the first image
var next = (num < (zoombag.length - 1) ? (num + 1) : 0);
// check if there is a prev image, if not use the last image
var prev = (num > 0 ? (num - 1) : (zoombag.length - 1));

document.zoom.s rc = zoombag[num]
window.top.next zoom = next;
window.top.prez oom = prev;
}

This will link the first Prev to the last image and the last Next to
the first image (this could also be done by using if { .. }
statements, the (A ? B : C) is just shorthand for if A (is true) then
B else C.

The first line could also be written as
if (num < zoombag.length - 1)
var next = num + 1;
else
var next = 0;

Last (but not least) the loop you use in the splitsm function should
be written as

for (num = 0; num < 12; num++)

(start with num at 0 and loop until num is 12 or more)
Nice website by the way!
Kind regards,

Jeroen Brattinga
Trent wrote:
Hey All,

I am new to javascript and currently coding a site with scripts that
are beyond my level of understanding. The problematic page has
thumbnail images that can be clicked on to zoom in. When clicked, the
preloaded larger image displays in a div layer that gets turned on. The
problem is that ie sometimes does not display the image - the
placeholder just stays blank. The script works fine in firefox and
netscape (haven't tried safari yet). Since I am new to this and this
only happens sporadically, I'm having a lot of trouble identifying the
error or a fix. Also, the src for the images is dynamically created
from the text name that displays below the bags. This is for content
management purposes. Any suggestions you can give would be much
appreciated.

Thanks,

Trent

Here is the link: www.woundedmouse.com/pearson/showroom.html

Here is the pertinent code:

<SCRIPT TYPE="text/javascript">
/* SNIP */

Jul 23 '05 #2
Thanks for the reply Jeroen - I really appreciate your help. I'll let
you know the outcome.

Jul 23 '05 #3

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

Similar topics

4
1611
by: Jon Glazer | last post by:
I have a small function that simply swaps image A with image B. The problem is that in some situations (i don't know why yet) when A and B are swapped, they simply vanish. Here is the function (with a transition): <script> var pictemp=new Image(); function replacemain(id){ if (document.all){ document.images.MainImage.style.filter="blendTrans(duration=2)" document.images.MainImage.filters.blendTrans.Apply()
6
2880
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a TimerState object similar to the example in the System.Threading.Timer documentation. The method which handles the timer events, among other things, periodically calls a method in this TimerState object which raises an event to the startup form,...
7
2264
by: Jacob | last post by:
Has anybody else encountered a problem when running your asp.net applications off your localhost and having broken image links? The weird thing is, the links aren't really broken. The reference is correct. And what's weirder that than, it will only do it sporadically. I can refresh the screen and those images that were once broken are now visible but some others may now be broken. Or sometimes they all work, sometimes none. This...
4
2299
by: MVSGuy | last post by:
Hello, I have a problem where a Notes field shows up in Access (via ODBC connection) but the value is either zero or blank in Access. I've verified the field is not zero or blank in Notes. Background - This is an existing ODBC connection from Access to Notes. For all other fields, it works fine. I've added a number field to the Notes database. It shows up in Access but never has the correct value. Is there something simple I'm...
2
2110
by: eBob.com | last post by:
I have a print application modeled on a program which I found via this newsgroup. (I still have comments in German in it!) The model uses ExtendedPrintPreviewDialog but I don't seem to have that so I am using PrintPreviewDialog. It prints fine. But the PrintPreview dialog shows only one blank page. Before I resort to posting code, is there some simple and/or common mistake I could have made which would explain why PrintPreview shows...
1
3473
by: dr1ft3r | last post by:
I, like many others, hate IE simply because it doesn't go along with standard and bothers every site anybody attempted to make in the history of the web. I've checked this site in FF, NS, and Opera and they're perfect; identical. IE7 renders a blank page. Why? Probably because it's not rendering the style sheet. Why? I have no idea. All I know is this site is so simple right now, if you take away the style sheet you're pretty much looking at...
8
5415
by: jonmundsack | last post by:
I have an intranet site on my LAN which has "anonymous access" turned OFF, and "integrated Windows authentication" turned on. This allows me to access the "AUTH_USER" server variable, which I use to look up application rights in SQL Server. With IE6 clients, this has worked flawlessly for several years. Our users are currently running IE6, but my parent agency has announced an upgrade to IE7 beginning next month, so I have installed...
3
2248
by: simon2x1 | last post by:
the code below will upload image and insert the image name and other variable into the database but i dont want the upload feild to post a blank field and also not to allow any image which is not gif, jpeg and png. the code that i have that can do the folowing are if($_FILES == 0){ and if (!eregi("^(+)\.jpg|\.gif|\.png$", $logoname)) but the problem is i dont know where to insert it in the code below (upload.php) i try inserting it but did not...
0
9568
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
9404
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
10007
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
9959
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
9835
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...
1
7379
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
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
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.