IE and mozilla auto resize pics

  waydekirrane 14:06 14 Sep 04
Locked

i've just uploaded a picture to a website that pops up, using some javascript, when you click a link. the java enables me to stipulate the size of the window that opens to show the picture. is it possible to keep the picture at it's original size and scroll bars to appear on the pop up windon instead.

the script i'm using is:

script>


function openpopup1(){
var popurl="picture1.gif"
winpops=window.open(popurl,"","width=000,height=000,resizable=1,location=0,left = 000,top = 000")
}

/script>


a href="javascript:openpopup1()">link to picture1 /a>

  Eric10 15:06 18 Sep 04

This may not be the definitive answer but my way of doing this would be to make an html page that contains the picture. This will allow you to set the size that you want for the picture, centre the picture on the page and include a background colour and also text if required. You will then use a script to launch the new page instead of just the picture. I don't know enough about writing javascript to play about with your existing script (I did manage to put a scrollbar on the popup but couldn't stop the picture from resizing which made the scrollbar irelevant) but here is a script I use to launch new windows on my own site. As it stands this opens the new window in the top-left of the screen but this can be changed by altering the value of winl (left) and wint (top). The new window will not have menus or toolbars so will be very similar to the popup you now have.


<script language="JavaScript">

function newWindow(mypage, myname, w, h, scrol) {

var winl = 10;

var wint = 10;

winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scrol+',resizable=1';

win = window.open(mypage, myname, winprops);

if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }

</script>


usage: <a href="javascript:newWindow('picture1_page.htm', 'picture1',400, 400,'yes')">link to picture1</a>

Substitute "picture1_page.htm" with the name of your page containing the picture, "picture1" is a name for the new window and can be anything of your choice but if the same name is used again while the window is still open then the new page will load into the same window, while using a different name will open another window. Next come the width and height of the new window followed by a value of 'yes' or 'no' for scrollbars (1 or 0 will also work here).


The code for the picture page could be as simple as:

<html>

<head>

<title>Picture1_Page</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta http-equiv="imagetoolbar" content="no">

</head>

<body>

<p align="center"><img src="picture1.jpg"></p>

<p>Descriptive text for picture if required</p>

</body>

</html>

  waydekirrane 15:30 06 Dec 04

thanks
i can't get it to work
i've changed the url of the new page i created and tried a title that matches the title tag of the new page. i even took out the ' at the end of:

llbars='+scrol+',resizable=1';

as it didn't look right

still not getting a pop up. can you help pls

  dez fowler 20:40 06 Dec 04
  Eric10 21:38 06 Dec 04

click here for a working test page. Right-click on the page and view source for the code.

This thread is now locked and can not be replied to.

How to get Windows 10 for free | How to install Windows 10: There is still a way to avoid paying…

1995-2015: How technology has changed the world in 20 years

Alex Chinneck’s giant ice cube Christmas tree at Kings Cross

Apple rumours & predictions 2017: The iPhone 8, new iPads, and everything else you should expect fr7…