/    Sign up×
Community /Pin to ProfileBookmark

random margin added around picture in window.open

i have a page that has about 27 thumbnails that i want to open
in a new window without a margin. there is no pattern to it, but every
so often, a margin is added to the top and left of the image. here is
the script that i am using:

var newwindow = ”
var win1
function ShowMe(url) {
if (win2=1){
win2.close;
}
if (newwindow.location && !newwindow.closed) {
newwindow.location.href = url;
newwindow.focus(); }
else {
newwindow=window.open(url,’win1′,’width=289,height=188,resizable=0,toolbar=no’);}
newwindow.document.write(‘<html><head></head><title>2005 UGM</title><body topmargin=”0″ leftmargin=”0″ bgcolor=”000000″><img src=”‘+url+'”></body></html>’)
win1=1
}

any help would be appreciated…

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@Elliott_HirdJan 12.2006 — <head></head> =

<head><style>*{padding:0;margin:0;display:inline}</style></head>
Copy linkTweet thisAlerts:
@u_make_hulk_madauthorJan 12.2006 — so

<html><head></head><title>2005 UGM</title><body topmargin="0" leftmargin="0" bgcolor="000000"><img src="'+url+'"></body></html>'

goes to?

<html[COLOR=Blue]><head><style>*{padding:0;margin:0;display:inline}</style></head>[/COLOR]<title>2005 UGM</title><body topmargin="0" leftmargin="0" bgcolor="000000"><img src="'+url+'"></body></html>'
Copy linkTweet thisAlerts:
@u_make_hulk_madauthorJan 13.2006 — still looking for a solution. i don't know why my tags had the forward slash in them,

but i took them out and i'm still having the problem
Copy linkTweet thisAlerts:
@u_make_hulk_madauthorJan 16.2006 — var newwindow = ''

var win1

function ShowMe(url) {

if (win2=1){

win2.close;

}

if (newwindow.location && !newwindow.closed) {

newwindow.location.href = url;

newwindow.focus();

}

else {

newwindow=window.open(url,'win1','width=289,height=188,resizable=0,toolbar=no');

}

newwindow.document.write('<html><head></head><title>2005 UGM</title><body style="margin:0;padding:0" bgcolor="000000"><img src="'+url+'"></body></html>');

win1=1

}

var newwindow2 = ''

var win2

function ShowMe2(url) {

if (win1=1){

win1.close;

}

if (newwindow2.location && !newwindow2.closed) {

newwindow2.location.href = url;

newwindow2.focus(); }

else {

newwindow2=window.open(url,'win2','width=188,height=289,resizable=0,toolbar=no');

}

newwindow2.document.write('<html><head></head><title>2005 UGM</title><body style="margin:0;padding:0" bgcolor="000000"><img src="'+url+'"></body></html>');

win2=1

}



function tidy() {

if (newwindow.location && !newwindow.closed) {

newwindow.close();

}

}


this is my most recent, and i am still having the problem. anybody?
Copy linkTweet thisAlerts:
@u_make_hulk_madauthorJan 16.2006 — i could really use some help with this one. there are 100+ people lurking around here at any given time. someone has to know of something i can do...

i need some sort of solution here even if it means a totally different

approach.
Copy linkTweet thisAlerts:
@FromU2MEJan 16.2006 — So, you can open the popup and you see the image that you want, but the page has margins?
Copy linkTweet thisAlerts:
@u_make_hulk_madauthorJan 16.2006 — So, you can open the popup and you see the image that you want, but the page has margins?[/QUOTE]

yes, the image opens everytime but sometimes, with no pattern to it, there

is a white margin placed at the top and left of the image.
Copy linkTweet thisAlerts:
@FromU2MEJan 16.2006 — I think the code in red is the troublemaker... Because, there, you simply send the user straight to the image (without any HTML at all) - in which you cannot control the margins ?

[CODE]var newwindow = '';
var win1;

function ShowMe(url) {

if (win2=1) {
win2.close;
}

if (newwindow.location && !newwindow.closed) {
[COLOR=Red]newwindow.location.href = url;[/COLOR]
newwindow.focus();
}
else {
newwindow = window.open(url,'win1','width=289, height=188, resizable=0, toolbar=no');
}

newwindow.document.write("<html><head></head><title>2005 UGM</title><body style="margin:0; padding:0" bgcolor="#000000"><img src="'+url+'"></body></html>");

win1=1;

}[/CODE]
Try this:

[code=php]var newwindow = '';
var win1;

function ShowMe(url) {

/*
Do what you want with this ;)

if (win2=1) {
win2.close;
}
*/

if (!(newwindow.location && !newwindow.closed)) {
newwindow = window.open('','win1','width=289, height=188, resizable=0, toolbar=no');
}

newwindow.document.write("<html><head></head><title>2005 UGM</title><body style="margin:0; padding:0" bgcolor="#000000"><img src="'+url+'"></body></html>");
newwindow.focus();

win1=1;

}[/code]
Copy linkTweet thisAlerts:
@u_make_hulk_madauthorJan 17.2006 — i tried that to no avail. i'm not sure that the code in red is the troublemaker. the html is getting put into the window, because most of the time, there isn't a margin. this is driving me crazy!
×

Success!

Help @u_make_hulk_mad spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...