Finns det något sätt att inte definera storleken på bilden i detta skript, dvs jag ska kunna sätta in vilken bild som helst så ska den sedan förstora eller förminska precis som användaren vill.
Satchmo the man the myth the problemmaker.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<div align="center">
<script language="javascript">
<!--
var fitWindowRatio = 1;
var fitHeight = 224;
var fitWidth = 420;
var fitStr = fitWidth + "|" + fitHeight;
function ResizePhoto(size)
{
if (size == "fit")
size = fitStr;
var sizeArray = size.split("|");
var width = sizeArray[0];
var height = sizeArray[1];
document.photo_.width=width;
document.photo_.height=height;
if (document.frame1)
{
document.frame1.width=width;
document.frame3.height=height;
document.frame4.height=height;
document.frame6.width=width;
}
}
if ((navigator.appName.indexOf("Internet Explorer") != -1) &&
(navigator.userAgent.indexOf("Mozilla/4.") != -1))
{
var str = "<td align=center bgcolor=\"#FFFFC6\"><font face=arial size=-1>";
str += "<img width=1 height=1 src=\"/img/search.gif\"><select name=\"sizeSelect\" onChange=\"ResizePhoto(this.options[this.selectedIndex].value)\">";
str += "<option value=\"200|160\">Smallest 200*160";
str += "<option value=\"400|321\">Small 400*321";
str += "<option value=\"fit\">Fit Window";
str += "<option value=\"800|600\" selected>Normal 800*600";
str += "<option value=\"1024|768\">Large 1024*768";
str += "<option value=\"1280|1024\">Largest 1280*1024</font>";
str += "</select></td>";
document.writeln(str);
}
//-->
</script>
<br>
<img border=0 src="photo.500.jpg" alt="500 spänn" width=420 height=224 name="photo_">
</div>
</body>
</html>