I have the following code, which dynamically writes the code to display images in an ‘Image Viewer’ type window.
[CODE]<!–
PositionX = 100;
PositionY = 100;
if (parseInt(navigator.appVersion.charAt(0))>=4)
{
var isNN=(navigator.appName==”Netscape”)?1:0;
var isIE=(navigator.appName.indexOf(“Microsoft”)!=-1)?1:0;
}
var optNN=’scrollbars=no,width=760,height=500,left=’+PositionX+’,top=’+PositionY;
var optIE=’scrollbars=no,width=740,height=480,left=’+PositionX+’,top=’+PositionY;
function gWindow(imageURL)
{
if (isNN)
{
imgWin=window.open([B]’about:blank'[/B],”,optNN);
}
if (isIE)
{
imgWin=window.open([B]’about:blank'[/B],”,optIE);
}
[COLOR=Red]with (imgWin.document)[/COLOR]
{
writeln(‘<html>’);
writeln(‘<head>’);
writeln(‘<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ >’);
writeln(‘<meta http-equiv=”imagetoolbar” content=”no” >’);
writeln(‘<title>Aylesford School Image Viewer</title>’);
writeln(‘<style>’);
writeln(‘body’);
writeln(‘{‘);
writeln(‘ margin: 0px;’);
writeln(‘}’);
writeln(‘</style>’);
writeln(‘<sc’+’ript>’);
writeln(‘var isNN,isIE;’);
writeln(‘if (parseInt(navigator.appVersion.charAt(0))>=4)’);
writeln(‘{‘);
writeln(‘ isNN=(navigator.appName==”Netscape”)?1:0;’);
writeln(‘ isIE=(navigator.appName.indexOf(“Microsoft”)!=-1)?1:0;’);
writeln(‘}’);
writeln(‘if (isIE)’);
writeln(‘{‘);
writeln(‘ width=100-(document.body.clientWidth-document.images[0].width);’);
writeln(‘ height=100-(document.body.clientHeight-document.images[0].height);’);
writeln(‘ if (isNN)’);
writeln(‘ {‘);
writeln(‘ window.innerWidth=document.images[“Image”].width;’);
writeln(‘ window.innerHeight=document.images[“Image”].height;’);
writeln(‘ }’);
writeln(‘}’);
writeln(‘</sc’+’ript>’);
writeln(‘</head>’)
writeln(”);
writeln(‘<body bgcolor=000000 scroll=”no” onload=”self.focus()”>’);
writeln(‘<img name=”Image” src=”‘+imageURL+'”‘);
writeln(”);
writeln(‘</body></html>’);
}
}
// –>
But instead of referencing ‘about:blank’ (in bold), i’d like to reference another page with some extra styling/coding, but place the above code (obviously removing bits such as <head> and <body> tags) inside a table cell.
I’ve tried giving the table cell in question a name=”imageAnchor” attribbute, and changing
[CODE][COLOR=Red]with (imgWin.document)[/COLOR]
to
[CODE]with (imgWin.document.imageAnchor)
But it doesn’t work.
Is this possible, or am I going to need to dynamically code every line, including that from the seperate page?
Thanks very much/…