[Javascript] image control in Netscape
Golden Troll
gtroll at qwest.net
Sun Dec 9 20:25:23 CST 2001
This might help not sure if it works in nn4.78
function
JustSoPicWindow(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugM
argin) {
// by E Michael Brandt of ValleyWebDesigns.com - Please leave these
comments intact.
// version 3.0.4
if (bgcolor=="") {
bgcolor="#FFFFFF";
}
var adj=10
var w = screen.width;
var h = screen.height;
var byFactor=1;
var bg = "/images/pursilkbackrnd.jpg"
if(w<740){
var lift=0.90;
}
if(w>=740 & w<835){
var lift=0.91;
}
if(w>=835){
var lift=0.93;
}
if (imageWidth>w){
byFactor = w / imageWidth;
imageWidth = w;
imageHeight = imageHeight * byFactor;
}
if (imageHeight>h-adj){
byFactor = h / imageHeight;
imageWidth = (imageWidth * byFactor);
imageHeight = h;
}
var scrWidth = w-adj;
var scrHeight = (h*lift)-adj;
if (imageHeight>scrHeight){
imageHeight=imageHeight*lift;
imageWidth=imageWidth*lift;
}
var posLeft=0;
var posTop=0;
if (hugger == "hug image"){
if (hugMargin == ""){
hugMargin = 0;
}
var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
if (scrHeightTemp < scrHeight) {
scrHeight = scrHeightTemp;
}
var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
if (scrWidthTemp < scrWidth) {
scrWidth = scrWidthTemp;
}
if (scrHeight<100){scrHeight=100;}
if (scrWidth<100){scrWidth=100;}
posTop = ((h-(scrHeight/lift)-adj)/2);
posLeft = ((w-(scrWidth)-adj)/2);
}
if (imageHeight> (h*lift)-adj || imageWidth> w-adj){
imageHeight=imageHeight-adj;
imageWidth=imageWidth-adj;
}
posTop = parseInt(posTop);
posLeft = parseInt(posLeft);
scrWidth = parseInt(scrWidth);
scrHeight = parseInt(scrHeight);
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf("opera") != -1){
var args= new Array();
args[0]='parent';
args[1]=imageName;
var i ; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2)
eval(args[i]+".location='"+args[i+1]+"'");
} else {
newWindow =
window.open("vwd_justso.htm","newWindow","width="+scrWidth+",height="+sc
rHeight+",left="+posLeft+",top="+posTop);
newWindow.document.open();
newWindow.document.write('<html>' + '<META HTTP-EQUIV\="imagetoolbar"
CONTENT\="no"><title>'+alt+'</title><body leftmargin="0" topmargin="0"
marginheight="0" marginwidth="0" bgcolor='+bgcolor+' background='+bg+'
onBlur="self.close()" onClick="self.close()"');
newWindow.document.write('<table width='+imageWidth+' border="0"
cellspacing="0" cellpadding="0" align="center"
height='+scrHeight+'><tr><td>');
newWindow.document.write('<img src="'+imageName+'" width='+imageWidth+'
height='+imageHeight+' alt="Click screen to close">');
newWindow.document.write('</td></tr></table></body></html>');
newWindow.document.close();
newWindow.focus();
document.returnValue = false;
}
}
Peace and Respects,
Scott Gahres
Owner
Golden Troll four20 Ventures P.O. Box 16268 Portland OR 97292
*@goldentroll.com http://goldentroll.com
* hemp info send e-mail w/ subscribe in subject and your
nickname and e-mail in the body
*(c)2000 4:20 has been a trademark of Golden Troll since 1994
-----Original Message-----
From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
Behalf Of Dave
Sent: Sunday, December 09, 2001 10:16 AM
To: javascript at LaTech.edu
Subject: [Javascript] image control in Netscape
Hi,
I have overcome the problem of getting my full sized images (from
thumbnails) to be displayed onto a single html page with my matching
website background but have run into a new problem. When the 320 x 240
image opens in IE it looks 320 x 240, but when the same image opens in
Netscape (4.78) it is inflated in size and looks blurry. Here is the
line that I am using to display the image:
document.write("<a href=\"javascript:history.back()\"><img
src=\""+window.location.search.substring(1,window.location.search.length
)+"\"
height=90% border=2 alt=\"back to index\"></a>");
See anything I could do to fix that from here? The image is called from
another webpage using the following:
<td align="center"><A HREF="viewer.html?./mypicture.jpg">
and is a 640x480 original shrunk to 320x240 to clear it up a bit and
then saved as a jpg. Thanks in advance for any and all possible fixes...
Dave K (in Florida USA)
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list