473,394 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

HELP: Opening images in Pop-up

Hello,

I'm buidling a friends-website. I have bunch of pictures. I used the
javascript to open the images in real size in a pop-up.
<script language="JavaScript">
<!--
function nph_open_window(url, name, feature)
{
window.open(url, name, feature);
}
// -->
</script>
And I call it with:
<a href="javascript:nph_open_window('Foto/heid/heid10.jpg', 'heid10',
'width=550,height=400,toolbar=no,menubar=no,status =no,scrollbars=no,resizabl
e=no')"> <img src="Foto/heid/heid10l.jpg" width="102" height="72"
border="0"></a>
BUT when the pop-up opens, I see the LEFT and TOP border/margin. So it
doesn't fit exactly in the pop-up.

Can someone help me to fix it ?
Thanks !

Jul 23 '05 #1
7 1857
"Joker" <ra***@hotmail.com> wrote in message
news:33***************************@news.multikabel .nl...
Hello,

I'm buidling a friends-website. I have bunch of pictures. I used the
javascript to open the images in real size in a pop-up.
<script language="JavaScript">
<!--
function nph_open_window(url, name, feature)
{
window.open(url, name, feature);
}
// -->
</script>
And I call it with:
<a href="javascript:nph_open_window('Foto/heid/heid10.jpg', 'heid10',
'width=550,height=400,toolbar=no,menubar=no,status =no,scrollbars=no,resizabl e=no')"> <img src="Foto/heid/heid10l.jpg" width="102" height="72"
border="0"></a>
BUT when the pop-up opens, I see the LEFT and TOP border/margin. So it
doesn't fit exactly in the pop-up.

Can someone help me to fix it ?
Thanks !


How about the following; watch for word-wrap:
<html>
<head>
<title>open_win.htm</title>
<script type="text/javascript">
function nph_open_window(url,wid,hgt) {
var nam = url.substring(url.lastIndexOf("/")+1,url.length-4);
var cfg = "width="+wid+",height="+hgt+",resizable=no";
var htm = "<html>";
htm += "<body leftmargin='0' topmargin='0'>";
htm += "<img src='" + url +"' border='0' alt=''>";
htm += "</body>";
htm += "</html>";
var win = window.open("",nam,cfg);
win.document.write(htm);
}
</script>
</head>
<body>
<img src="Foto/heid/heid10l.jpg"
border="0" width="102" height="72"
alt="Click to enlarge." style="cursor:hand"
onclick="nph_open_window('Foto/heid/heid10.jpg',550,400)">
</body>
</html>
Since you may have pictures of different sizes, the dimensions are passed to
the finction.

Note that your thumbnail images may be distorted if they're all displayed at
102 x 72.
Also, here's some info on the window.open method:
http://www.devguru.com/Technologies/.../win_open.html

Jul 23 '05 #2
McKirahan wrote:

--- snip ---

################################################## #########
htm += "<body leftmargin='0' topmargin='0'>";

################################################## #########
leftmargin and topmargin did never belong to the HTML-standard
as defined by the W3C, better use CSS instead:
html += "<body style='margin: 0'>"

--- snip ---

cu, Michael
Jul 23 '05 #3
On Mon, 5 Jul 2004 18:34:18 +0200, "Joker" <ra***@hotmail.com> wrote:

I used the javascript to open the images in real size in a pop-up.
<script language="JavaScript">
<!--
function nph_open_window(url, name, feature)
{
window.open(url, name, feature);
}
// -->
</script>
And I call it with:
<a href="javascript:nph_open_window('Foto/heid/heid10.jpg', 'heid10',
'width=550,height=400,toolbar=no,menubar=no,statu s=no,scrollbars=no,resizabl
e=no')"> <img src="Foto/heid/heid10l.jpg" width="102" height="72"
border="0"></a>
BUT when the pop-up opens, I see the LEFT and TOP border/margin. So it
doesn't fit exactly in the pop-up.


Not clear what you mean by LEFT and TOP. In any event, how big is the
image? Is it 550 x 400? If so, then you have to leave enough room
for margins around the image. 550 x 400 would be the total size of the
window, not counting the borders and title bar.

Myron Turner
www.room535.org
Jul 23 '05 #4
Joker wrote:
Hello,

I'm buidling a friends-website. I have bunch of pictures. I used the
javascript to open the images in real size in a pop-up.

Just in passing - what about browsers (such as all the modern ones) that
can stop pop-ups (and do so by default)?
Jul 23 '05 #5
Thank you very much !!
"Michael Schmitt" <mi****@wel.de> schreef in bericht
news:cc************@news.t-online.com...
McKirahan wrote:

--- snip ---

################################################## #########
htm += "<body leftmargin='0' topmargin='0'>";

################################################## #########
leftmargin and topmargin did never belong to the HTML-standard
as defined by the W3C, better use CSS instead:
html += "<body style='margin: 0'>"

--- snip ---

cu, Michael

Jul 23 '05 #6
Mark Preston wrote:
Joker wrote:
Hello,

I'm buidling a friends-website. I have bunch of pictures. I used the
javascript to open the images in real size in a pop-up.

Just in passing - what about browsers (such as all the modern ones) that
can stop pop-ups (and do so by default)?


My Mozilla is configured to block unrequested popups. But in this case the
popup-window is _not_ unrequested, so it opens as wanted. A different
question would be, what's about people, who have javascript disabled?

cu Michael
Jul 23 '05 #7
Michael Schmitt wrote:
McKirahan wrote:
htm += "<body leftmargin='0' topmargin='0'>";
################################################## #########


Please learn how to quote in Usenet.
leftmargin and topmargin did never belong to the HTML-standard
as defined by the W3C,
Correct.
better use CSS instead:
html += "<body style='margin: 0'>"


The CSS equivalent would be <body style='margin-left:0; margin-top:0'>.
Your code removes the margins on all sides.
PointedEars
Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Johannes Götzinger | last post by:
hello everyone, I use a script to save .jpg-images in a mysql database. Another small script outputs the database-stored-image to the browser (getdbfile?id=1). All works fine. Now I want to...
3
by: Display Name | last post by:
When this form's being submitted, two windows are opening instead of only one here is the function I'm using: function subForm(){ //insert form validation here //if form is valid, open a...
5
by: Richard Hollenbeck | last post by:
I have pages that I want a particular person to download dozens of images. Instead of opening each image separately with right-clicks, I want to be able to have them simply click, and the program...
2
by: sjp | last post by:
I need to open new windows only for the purpose of viewing linked images, maybe a dozen or so throughout the site. Using the Target="blank" command is quick, easy and seems like the best way to...
24
by: Apotheosis | last post by:
The problem professor gave us is: Write a program which reads two integer values. If the first is less than the second, print the message "up". If the second is less than the first, print the...
0
by: john | last post by:
Hi,All MS Tech Gurus: I need your help!!! It is the second time I post this message, I need get some feedback ASAP, Please Help!! Thanks a lot in advance. John I have a csharp method, using...
2
by: Mark R. Dawson | last post by:
Hi all, I have a directory full of images (most over 2MB in size) I was to show each image as a thumbnail on a form, however in order to create a thumbnail I have to open the complete image then...
4
by: Gary | last post by:
Can somebody help me get the onMouseOut to work in this script? The onMouseOver works great opening a new window with an image, but I'd like to get the popup window to close onMouseOut. Is this...
1
by: Xah Lee | last post by:
The following is a program to generate thumbnail images for a website. Useful, if you want to do that. It is used to generate the thumbnails for my “Banners, Damsels, and Mores” project...
1
by: geetamadhavi | last post by:
Hi All, I have developed a php applciaiton where a new window is opening on checking the whether valid user orntot how to make that in same window after checking i have die(' not valid user ' ); i...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.