Currently my website is utilizing some JavaScript to (onclick) open a new window, and automatically size it to an image, and auto-close when it is no longer the active window (ie, click elsewhere).
However, I want to rid my HTML 4.01 of any Javascript, simply because a significant portion of my viewing audience has disabled all JS.
Is there a way to auto-size a new window around an image through something besides JS? PHP? ASP? CSS even? I'm afraid I don't know enough about the capabilities of these languages to know which to learn more about first.
Many thanks,
Raw JS script below for reference if necessary::
<script type="text/javascript">
PositionX = 25;
PositionY = 25;
defaultWidth = 1050;
defaultHeight = 850;
var AutoClose = true;
if (4<=parseInt(navigator.appVersion.charAt(0))){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<HTML><HEAD><TITLE>Loading...</TITLE><STYLE>body{margin:0px;}</STYLE>');writeln('<SC'+'RIPT>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');
writeln('window.innerWidth=document.images["FalkPic"].width;');writeln('window.innerHeight=document.images["FalkPic"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</SC'+'RIPT>');
if (!AutoClose) writeln('</HEAD><BODY bgcolor="000000" scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</HEAD><BODY bgcolor="000000" scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<IMG name="FalkPic" src='+imageURL+' style="display:block" alt=""></body></html>');
close();
}}
</SCRIPT>
However, I want to rid my HTML 4.01 of any Javascript, simply because a significant portion of my viewing audience has disabled all JS.
Is there a way to auto-size a new window around an image through something besides JS? PHP? ASP? CSS even? I'm afraid I don't know enough about the capabilities of these languages to know which to learn more about first.
Many thanks,
Raw JS script below for reference if necessary::
<script type="text/javascript">
PositionX = 25;
PositionY = 25;
defaultWidth = 1050;
defaultHeight = 850;
var AutoClose = true;
if (4<=parseInt(navigator.appVersion.charAt(0))){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<HTML><HEAD><TITLE>Loading...</TITLE><STYLE>body{margin:0px;}</STYLE>');writeln('<SC'+'RIPT>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');
writeln('window.innerWidth=document.images["FalkPic"].width;');writeln('window.innerHeight=document.images["FalkPic"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</SC'+'RIPT>');
if (!AutoClose) writeln('</HEAD><BODY bgcolor="000000" scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</HEAD><BODY bgcolor="000000" scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<IMG name="FalkPic" src='+imageURL+' style="display:block" alt=""></body></html>');
close();
}}
</SCRIPT>




















