N
niconedz
Hi
The following code works fine in IE but not Firefox.
It's a little script that zooms an image and resizes the window to fit.
Can anybody tell me what's wrong?
Thanks
Nico
== btw.. sorry for the long post ==
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Aphrodite Hills</title>
<style type="text/css">
<!--
**SNIPPED**
-->
</style>
<script language="JavaScript">
<!--
function SymError()
{
return true;
}
window.onerror = SymError;
//-->
</script>
<script language="javascript"><!--
function window_resize(o_img, int_offset_h,
int_offset_w) {
table_all.style.visibility="hidden";
var int_max_h = window.screen.availHeight;
var int_max_w = window.screen.availWidth;
var int_size_h = o_img.height + int_offset_h;
int_size_h = (int_size_h > int_max_h) ?
int_max_h : int_size_h;
var int_size_w = o_img.width + int_offset_w;
int_size_w = (int_size_w > int_max_w) ?
int_max_w : int_size_w;
//window.moveTo(0,0);
int_size_w = (int_size_w>390)? int_size_w :
390;
window.resizeTo(int_size_w, int_size_h);
self.focus();
table_all.style.visibility="visible";
}
function resize(k) {
table_all.style.visibility="hidden";
self.o_img.width *= k;
self.o_img.height *= k;
window.resizeTo(self.o_img.width+50,
self.o_img.height+135);
table_all.style.visibility="visible";
}
function on_key_press() {
if (event.keyCode == "27") this.close();
else if (event.keyCode==43) resize(1.1);
else if (event.keyCode==45) resize(.9);
}
-->
</script>
</head>
<body onload="javascript:window_resize(self.o_img, 135, 50);"
onkeypress="on_key_press();">
<table id="table_all" height="100%" width="100%" border="0"
cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td>
<div align="left"><nobr>
<img src="assets/magnify_plus.gif" style="cursor:hand"
onclick="javascript:resize(1.1);" WIDTH="107" HEIGHT="24">
<img src="assets/magnify_minus.gif" style="cursor:hand"
onclick="javascript:resize(.9);" WIDTH="117" HEIGHT="24">
<a style="cursor:hand" onClick="window.print();"><img
src="assets/print.gif" width="89" height="24" border="0"></a>
</nobr></div></td>
</tr>
</table>
</td>
</tr>
<tr height="1">
<td bgcolor="#DDDECC"><img SRC="assets/spacer_trans.gif"
width="1"
height="1"></td>
</tr>
<tr>
<td align="center" valign="middle">
<img src="assets/plot239/dev239.jpg" name="o_img" width="390"
height="310" hspace="5" vspace="5" border="0" align="top" id="o_img">
</td>
</tr>
</table>
</body>
</html>
The following code works fine in IE but not Firefox.
It's a little script that zooms an image and resizes the window to fit.
Can anybody tell me what's wrong?
Thanks
Nico
== btw.. sorry for the long post ==
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Aphrodite Hills</title>
<style type="text/css">
<!--
**SNIPPED**
-->
</style>
<script language="JavaScript">
<!--
function SymError()
{
return true;
}
window.onerror = SymError;
//-->
</script>
<script language="javascript"><!--
function window_resize(o_img, int_offset_h,
int_offset_w) {
table_all.style.visibility="hidden";
var int_max_h = window.screen.availHeight;
var int_max_w = window.screen.availWidth;
var int_size_h = o_img.height + int_offset_h;
int_size_h = (int_size_h > int_max_h) ?
int_max_h : int_size_h;
var int_size_w = o_img.width + int_offset_w;
int_size_w = (int_size_w > int_max_w) ?
int_max_w : int_size_w;
//window.moveTo(0,0);
int_size_w = (int_size_w>390)? int_size_w :
390;
window.resizeTo(int_size_w, int_size_h);
self.focus();
table_all.style.visibility="visible";
}
function resize(k) {
table_all.style.visibility="hidden";
self.o_img.width *= k;
self.o_img.height *= k;
window.resizeTo(self.o_img.width+50,
self.o_img.height+135);
table_all.style.visibility="visible";
}
function on_key_press() {
if (event.keyCode == "27") this.close();
else if (event.keyCode==43) resize(1.1);
else if (event.keyCode==45) resize(.9);
}
-->
</script>
</head>
<body onload="javascript:window_resize(self.o_img, 135, 50);"
onkeypress="on_key_press();">
<table id="table_all" height="100%" width="100%" border="0"
cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td>
<div align="left"><nobr>
<img src="assets/magnify_plus.gif" style="cursor:hand"
onclick="javascript:resize(1.1);" WIDTH="107" HEIGHT="24">
<img src="assets/magnify_minus.gif" style="cursor:hand"
onclick="javascript:resize(.9);" WIDTH="117" HEIGHT="24">
<a style="cursor:hand" onClick="window.print();"><img
src="assets/print.gif" width="89" height="24" border="0"></a>
</nobr></div></td>
</tr>
</table>
</td>
</tr>
<tr height="1">
<td bgcolor="#DDDECC"><img SRC="assets/spacer_trans.gif"
width="1"
height="1"></td>
</tr>
<tr>
<td align="center" valign="middle">
<img src="assets/plot239/dev239.jpg" name="o_img" width="390"
height="310" hspace="5" vspace="5" border="0" align="top" id="o_img">
</td>
</tr>
</table>
</body>
</html>