Click to See Complete Forum and Search --> : Netscape Mystery


chickita
01-08-2004, 07:16 AM
I have a simple problem of cross-platform failure. I'm trying to open a popup window from a thumbnail with extra text below. Here is the html I'm using at present which works with IE but not Netscape or any other browser:

<!-- Image Pop upscript Begin -->
<SCRIPT language=JavaScript>
var width,height
var image,ext
var cond1,cond2
function transferview(image,width,height,text) {
if (width==0) cond1=" "
else cond1="width="+(width+20)+"";
if (height==0) {cond2=" "};
else {cond2="height="+(height+70)+""};

var s1 ="<WEBPAGE TITLE</TITLE>"
var s2 ="<CENTER><IMG SRC='"+image+"' BORDER=1>"
var s3 ="<p>"+text+"</p>"
var s4 ="<FORM><INPUT TYPE='BUTTON' VALUE='Close Window'"+ " onClick='self.close()'>"
var s5 ="</FORM></CENTER>"

ImageWindow=window.open("", "newwin"+width,"toolbar=no,scrollbars=yes,menubar=no,top=0,left=0,"+cond1+"," +cond2);
ImageWindow.document.write(s1+s2+s3+s4+s5)
ImageWindow.document.close()
}
</SCRIPT>
<!-- Image Pop upscript End -->

Image html:

<a href="#" onClick="javascript:transferview('image.jpg',530,440,'Photo Description')"><img border="0" src="image_thumb.jpg" alt="View Photo"></a>


Could someone tell me what I have to modify or add to make it work in at least Netscape or if possible all browsers.

Thanks.

Fang
01-08-2004, 07:45 AM
if (height==0) {cond2=" ";};
else {cond2="height="+(height+70)+"";};

Remove the red add the green
See JavaScript Lint (http://www.crockford.com/javascript/jslint.html)

chickita
01-08-2004, 07:58 AM
It works! Thanks so much Fang. I knew it was something so simple it couldn't be hard to fix.

You're a star :D