Fred said:
this is a problem i can't figure out.
I can't get IE to link to a new widown with width/height attributes as i can
in other browsers. It works in NN, Op, Moz.
The code is all on the same line as per msdn
Here's the code:
..
<a href="#" target="_self" onClick="window.open('images/prod/Ggps2.jpg','GPS
II','toolbar=no,width=200,height=200,left=50,top=50,status=no,scrollbars=no,
resize=no');return false"><img border="0" src="images/thumb/Ggps2.gif"
alt="GPS II" width="73" height="70"></a>.
..
any help would be appreciated
Fred
Everyone else missed the actual problem. The window name (2nd argument of
window.open()) can not contain spaces. Change it from "GPS II" to "GPSII" and it
should work as expected. However, a better design would be:
<a href="images/prod/Ggps2.jpg" target="GPSII"
onclick="
window.open(
this.href,
this.target,
'toolbar=no,width=200,height=200,left=50,top=50,status=no,scrollbars=no,resize=no'
);
return false;
"><img border="0" src="images/thumb/Ggps2.gif" alt="GPS II" width="73"
height="70"></a>
Now you get a new window with the right image regardless of whether Javascript
is enabled on the user's browser or not. Not to mention, if you do this multiple
times, you could now re-factor to move the window.open() call out of the onclick
event entirely:
<script type="text/javascript">
function openFullImage(lnk) {
window.open(
lnk.href,
lnk.target,
'toolbar=no,width=200,height=200,left=50,top=50,status=no,scrollbars=no,resize=no'
);
return false;
}
</script>
<a href="images/prod/Ggps1.jpg" target="GPSI"
onclick="return openFullImage(this);"><img ...></a>
<a href="images/prod/Ggps2.jpg" target="GPSII"
onclick="return openFullImage(this);"><img ...></a>
<a href="images/prod/Ggps3.jpg" target="GPSIII"
onclick="return openFullImage(this);"><img ...></a>
<!-- etc -->
The only problem with any of these designs is that an overly aggressive popup
blocker might block your full image window popups, even though they were
initiated by the user.
--
| Grant Wagner <
[email protected]>
* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp
* Netscape 6/7 DOM Reference available at:
*
http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
*
http://www.mozilla.org/docs/web-developer/upgrade_2.html