Forum Moderators: open

Message Too Old, No Replies

popup images

removing scroll bars from firefox popup

         

gecko001

10:52 pm on Oct 11, 2005 (gmt 0)

10+ Year Member



Hi Guys i am using a script to popup images i got from another source.
It works in ie but firefox leaves the scroll bars in
any ideas on how to remove them?

this is my script


<script language="Javascript" type="text/javascript">
<!--//
function imageView(imgFile,imgTitle,imgWidth,imgHeight,winPosX,winPosY){
preview = window.open("","","resizable=no,toolbar=no,scrollbars=no,menubar=no,status=no,directories=no,width="+imgWidth+",height="+imgHeight+",left="+winPosX+",top="+winPosY+"");
preview.document.write('<html><head><title>'+imgTitle+' - Click to close - <\/title><\/head>'
+'<body onBlur="self.focus();" marginWidth="0" marginHeight="0" topmargin="0" leftmargin="0">'
+'<center>'
+'<a href="java script:self.close()">'
+'<img border="0" alt="Image loading please wait...." src="'+imgFile+'" width="'+imgWidth+'" height="'+imgHeight+'">'
+'<\/a><\/center>'
+'<\/body><\/html>');
preview.document.close();
}
//-->
</script>

Also it seems that the popup image thinks it is a link to somewhere else instead of just being a static image that can be closed.

any help would be appreciated.

cheers
Gecko

Bernard Marx

11:57 pm on Oct 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Also it seems that the popup image thinks it is a link to somewhere else instead of just being a static image that can be closed.

<a href="java script:self.close()">

NB: javascript

gecko001

12:08 am on Oct 12, 2005 (gmt 0)

10+ Year Member



Thanks Bernard

so obvious in hindsight:-)

any idea on those scrollbars?

Bernard Marx

6:25 am on Oct 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Scrollbars? Hmmm...

+'<body scroll="no" onBlur="....

or some CSS equivalent.

Dijkgraaf

11:29 pm on Oct 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well you would think scrollbars=no would be sufficient, but it looks like FF is ignoring that.

One way to fix the problem is to add 4 pixels to the height when sizing the window, you will get a little bit of whitespace around the image, but the scroll bars dissapear.

preview = window.open("","","resizable=no,toolbar=no,scrollbars=no,menubar=no,status=no,directories=no,width="+imgWidth+",height="+(imgHeight+4)+",left="+winPosX+",top="+winPosY+"");

rocknbil

5:18 pm on Oct 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



=no or =false should do it, but it's just as easy to only put the attribute in if you need it. So if you don't use the scrollbars attribute on the open method, there will be no scrollbars. Also, your script may be getting confused by the nested double quotes. Try drawing off your parameters in a variable.

var params = "resizable,width="+imgWidth+",height="+imgHeight+",left="+winPosX+",top="+winPosY;

preview = window.open("","",params);

You noticed I left resizable in. Can you predict every situation of every browser, platform, and resolution out there, including scenarios that may not have yet been developed? If not, always allow the user to resize the window. Always. :-)

gecko001

7:20 pm on Oct 13, 2005 (gmt 0)

10+ Year Member



thank you all for your input :-)

I appreciate your help

Gecko