...

View Full Version : POP-UPS: Sizes, fit to screen?



Xero1997
09-07-2008, 04:09 PM
First of all, I am sorry about my terrible English, and I also soo sorry about my nooby knowladge in JS.

I have tried to make a pop-up window, which I did, but I had the following problems:

1. I can't make the pop-up to fit the source image size (which is 800*600).
I mean, I did gave the pop-up the parameters of width an height, but I want it to be fixed to a maximum size of 800*600, but also can be resized to a lower resolution than 800*600 only if needed.
(In the client has a screen resolution of 640*320, he could decrease the size of the pop-up, but can't increase more then 800*600)

2. If nm.1 is impossible (I hope it is possible), I want it to be atleast opened to fit automaticly the client's screen. (not fullscreen, browsers inner limits)

3. If nm.1 is possible, How do I make the pop-up align to the center of the screen? (of anykind of screen and for all of the possible resolutions, no matter if its 800*600 or 1280*1024)

This is the full source of the document, which has an image in it called "1" and on clicking the image, it opens exactly the same one in a pop-up window.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
background-color: #000000;

}
-->
</style></head>

<body>
<div align="center"><a href="javascript:void(0)" onclick="window.open('1.jpg','1','menubar=no,width=screen.width,height=screen.height,left = 200, top = 262,status=no,location=no,toolbar=no,scrollbars=yes,resizable=1')" ><img src="1.jpg" width="767" height="575" border="0"/></a></div>
</body>
</html>

Sorry for beeing a nudge or whatever I am (go ahead an call me names),
but I am just a beginner and I realy need your help :confused:

Thank you,
Xero1997

Philip M
09-07-2008, 04:33 PM
Your English is certainly not terrible - it is a lot better than some native speakers on this forum.

I don't think that it is possible to make the image resizeable downwards but not upwards.

Try this:-


<script type="text/javascript">

var win = null;
function NewWindow(mypage,myname,w,h,scroll) {
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings);
}

</script>

<a href="#" onclick="NewWindow('http://www.yoursite.com/page.html','myPop','800','600','Loading');" > Click Here For Popup </a>


The Moving Finger writes; and, having writ,
Moves on: nor all your piety nor wit
Shall lure it back to cancel half a line,
Nor all your tears wash out a word of it.

-- Omar Khayyam

Xero1997
09-07-2008, 04:55 PM
Your English is certainly not terrible - it is a lot better than some native speakers on this forum.

I don't think that it is possible to make the image resizeable downwards but not upwards.

Try this:-


<script type="text/javascript">

var win = null;
function NewWindow(mypage,myname,w,h,scroll) {
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings);
}

</script>

<a href="#" onclick="NewWindow('http://www.yoursite.com/page.html','myPop','800','600','Loading');" > Click Here For Popup </a>


The Moving Finger writes; and, having writ,
Moves on: nor all your piety nor wit
Shall lure it back to cancel half a line,
Nor all your tears wash out a word of it.

-- Omar Khayyam

I tired this, but how do I make it work, it shows me error on page.

Philip M
09-07-2008, 05:08 PM
I tired this, but how do I make it work, it shows me error on page.

Well it works for me (of course you must put in the appropriate URL.)
What is the error message you receive?

Xero1997
09-07-2008, 05:38 PM
Well it works for me (of course you must put in the appropriate URL.)
What is the error message you receive?

Just Error of Page. (in the status bar)
But... where do I need to enter the URL's? (I am a nooby soo... :o)

Philip M
09-07-2008, 06:38 PM
There is a much better cut-and paste script at:-

http://www.javascriptkit.com/script/script2/popimage2.shtml



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum