Hi!
On this page, ([URL=http://javascript.internet.com/page-details/dynamic-sized-image.html]http://javascript.internet.com/page-details/dynamic-sized-image.html
[URL=http://www.mazingerzpr.net/jshelp/showpic.html]click here to se it working
[URL=http://www.mazingerzpr.net/jshelp/showpic-code.htm]Here’s the code of my [I]showpic.html
[B]<html>
<HEAD>
<title>ShowPic</title>
<SCRIPT LANGUAGE=”JavaScript”>
<!– Begin
function showpic(src, w, h, alt, aln, pw, ph, bw, bh) {
if (src == null) return;
var iw, ih; // Set inner width and height
if (window.innerWidth == null) {
iw = document.body.clientWidth;
ih=document.body.clientHeight;
}
else {
iw = window.innerWidth;
ih = window.innerHeight;
}
if (w == null) w = iw;
if(h == null) h = ih;
if(alt == null) alt = “Picture”;
if(aln == null) aln = “middle”;
if(pw == null) pw = 100;
if(ph == null) ph = 100;
if(bw == null) bw = 0;
if(bh == null) bh = 0;
var sw = Math.round((iw – bw) * pw / 100);
var sh = Math.round((ih – bh)
if ((w * sh) / (h * sh / h);
else sh = Math.round(h
document.write(‘<img src=”‘+src+'” alt=”‘+alt+'” width=”‘+sw+'” height=”‘+sh+'” align=”‘+aln+'”>’);
}
// End –>
</script>
</HEAD>
<BODY onResize=”history.go(0);” topmargin=”0″ leftmargin=”0″ rightmargin=”0″ bottommargin=”0″ marginwidth=”0″ marginheight=”0″>
<script language=”javascript”>
showpic(“0001.JPG”,480,640,” Image “, “middle”);
</script>
</body>
</html>
Is there a way to change this script to open any image in stead of only one?
[URL=http://www.mazingerzpr.net/jshelp/]This link explains this, with some images, and examples
I have a page (image-opener.html) i’m using to open any image, at any size. Just have to set the image url after the “?”, and image’s W and H values on the link. Like this:
[URL=http://www.mazingerzpr.net/jshelp/image-opener.html?0003.JPG&427&641]image-opener.html?0003.JPG&427&641
[URL=http://www.mazingerzpr.net/jshelp/image-opener-code.htm]code for [I]image-opener.html
[B]<html>
<HEAD>
<title>image-opener</title>
</head>
</HEAD>
<body topmargin=0 leftmargin=0 bgcolor=black rightmargin=”0″ bottommargin=”0″ marginwidth=”0″ marginheight=”0″ scroll=”auto”>
<SCRIPT LANGUAGE=”JavaScript”>
<!–
this.window.focus();
querystring = this.location.search.substring(1,this.location.search.length);
pairs = new Array();
pairs = querystring.split(‘&’);
var quote = ‘”‘;
document.write(‘<img src=’ + ‘”‘ + pairs[0] + ‘”‘ + ‘ WIDTH=’ + pairs[1] + ‘ HEIGHT=’ + pairs[2] + ‘ ><BR>’);
// –>
</SCRIPT>
</html>
I’m very new to JS and have no idea how to make it work the way i want.
I was thinking on changing this line:
[B]showpic(“0001.JPG”,480,640,” Image “, “middle”);
to this
[B]showpic(‘+'”‘+pairs[0]+'”‘+’,’+pairs[1]+’,’+pairs[2]+’,”Image”, “middle”);
but it didn’t!!
Any ideas!
THANKS IN ADVANCE!!!