PDA

View Full Version : Internet Explorer for windows not showing img src changes



Meredith
04-16-2006, 04:47 AM
If you're using Internet Explorer on Windows, you can see what I'm talking about by going to one of my portfolio pages, and then click around on the thumbnails:

www.MeredithABaxter.com/Portfolio/Design/

The images don't always show up. Internet Explorer for Windows is the only browser that exhibits this inconsistent behavior. If you right click on the image area you can select "Show Picture" and it will show up. I don't understand why the images are disappearing.

When you click on a thumbnail I run the following code:



<a href="Javascript:;"
onMouseDown="curthumb=14;
var popx=getsize_x()*9/10;
var popy=getsize_y()*9/10;
var p1=popup('steadman.htm','mepop','Click here to view a larger image.',popx,popy,'no','yes');
var t1='Self-Portrait in the style of Ralph Steadman<br>ink<br>2004<br><br>'+p1;
document.getElementById('description').innerHTML=t1;
document.getElementById('counter').innerHTML=+curthumb+' / '+numthumb;
document.getElementById('view').src='Images/Med/Msteadman.gif';
document.getElementById('view').style.visibility='visible';
"><img class="thumb" src="Images/Small/Ssteadman.gif" width="50" height="50" alt="thumbnail"></a>

jscheuer1
04-16-2006, 07:21 AM
It only seems to happen after I've chosen to allow popups and view one. So, I think it may have something to do with the:


popup('steadman.htm','mepop','Click here to view a larger image.',popx,popy,'no','yes');

function. If written properly, the popup shouldn't require permission. This may or may not have anything to do with your problem. I'm not sure if I've followed your quoting scheme properly but, if so, you may have better luck with this version:


//POPUP
function popup(url,name,txt,width,height, menu, resize){
var murl='\"'+url+'\"';
var mname='\"'+name+'\"';
var mdim='\"toolbar='+menu+', scrollbars='+menu+', location='+menu+', status='+menu+', menubar='+menu+', resizable='+resize+', height='+height+',width='+width+'\"';
var p="<a href=\'"+url+"\' onclick=\'"+name+"=window.open(this.href,"+mname+","+mdim+"); "+name+".focus(); "+name+".resizeTo("+width+","+height+");return false;\'>"+txt+"</a>";
return p;
}

Meredith
04-16-2006, 03:49 PM
Here is the Popup function I'm using:



function popup(url,name,txt,width,height, menu, resize){
var murl='\"'+url+'\"';
var mname='\"'+name+'\"';
var mdim='\"toolbar='+menu+', scrollbars='+resize+', location='+menu+', status='+menu+', menubar='+menu+', resizable='+resize+', height='+height+',width='+width+'\"';
var p="<a href=\'javascript:;\' onMouseDown=\'var "+name+"=window.open("+murl+","+mname+","+mdim+"); "+name+".focus(); "+name+".resizeTo("+width+","+height+");\'>"+txt+"</a>";
return p;
}

Pretty much the same as what you've suggested?

It seems that on some machines, it acts up more when I open up the popup first, other times, it behaves this way even before you open a popup.

jscheuer1
04-16-2006, 04:10 PM
Have you tried it with my pop up code? Anyways, after I posted that, I tried mine out. It works and does not cause IE to prompt one to allow pop ups. The two major differences are that in my version the href is the same as the pop up url, in fact the href is used as the window.open() method's url and that the pop up occurs onclick instead of onmousedown.

I could not get your page to misbehave in IE without first having used at least one 'view larger image' link (the links generated by this very function). After that, it misbehaved a lot, without ever having to use a 'view larger image' link again. My thinking is that, by preventing the partial reload and repositioning of the content that answering 'allow pop ups temporarily' to the allow 'pop ups?' prompt causes, one might avoid the other problem altogether.

Meredith
04-16-2006, 04:34 PM
Hmmm, I put up your code on my site and tested it out again (cleared the cache etc etc) and I'm still seeing the problem on my windows IE browser. It even misbehaves before I click on the link. After I click on the link, it is much worse, however.

????

thanks for all of your help, by the way, i'm kind of new to JS and this kind of stuff drives me crazy.

jscheuer1
04-16-2006, 05:26 PM
I still cannot get it to behave badly without first using at least one view larger image. It is a bit of a compromise but, try this demo and see what happens:

http://home.comcast.net/~jscheuer1/side/meredith_h.htm

jscheuer1
04-16-2006, 06:07 PM
Here's another demo, works well here:

http://home.comcast.net/~jscheuer1/side/meredith_h_2.htm

Meredith
04-16-2006, 11:07 PM
This one works much better. Can you explain why you changed what you did?

jscheuer1
04-17-2006, 03:20 AM
You had many:


href="javascript:;"

This is non-standard so, became suspect when things weren't working. Another non-standard approach was using onmousedown instead of onclick. The main reason to do that is if onclick doesn't work. Onclick requires 'return false;' if used with an anchor link that you don't want firing. In this case, javascript:void(0); should have taken care of that but, using return false just makes one less thing that the browser needs to contend with and it was obviously having problems with the way things were.

The popup function that you have is overly complex for what you are using it for, I suspect that you got it as a sort of 'Swiss Army Knife' approach. I just cut it down more to what was needed and made it less likely to cause a browser to block the popup. I also added some code, using the existing functions for getting the window dimensions, to make it more likely that the popup would be entirely within the users viewable screen area.

Incidentally, the:


<base href="http://www.meredithabaxter.com/Portfolio/Design/" />

Is only required for an offsite demo. You can remove it for a page on your site but, leaving it shouldn't hurt anything.

Meredith
04-17-2006, 03:05 PM
Awesome. Thanks again for all your help!