View Full Version : popup margins or bgcolor?
Dirk Lance
11-18-2002, 04:19 PM
i am calling a gif into a popup and was wondering if there is any way to set the margins to none without creating a seperate .htm page and calling it.
heres the code im using (noting special)
function popUp5()
{
props=window.open('images/pics/glencontroller.gif', 'poppage', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=0, width=400, height=500');
}
and then calling it when the thumbnail of the pic is clicked on.
thanks
kdjoergensen
11-19-2002, 01:03 PM
No not excactly as you explain it, but you can't be that lazy ??
var popText = "<html><head><style>";
popText += "BODY { margin: 0px; background-color: green; }";
popText += "</style></head><body>";
var popText2 = "</body></html>";
function popUp5()
{
var output = popText + 'images/pics/glencontroller.gif' + popText2;
props=window.open(output, 'poppage', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=0, width=400, height=500');
}
The popText and popText2 are the same for all popUp functions.
By the way, and I HAVE to mention this. It is extremely poor coding to create mutiple popUp functions like you apparently are doing.
Make one master function and pass parameters to the function.
example:
function popUp5(imgUrl,w,h)
{
var output = popText + imgUrl + popText2;
var configs = "toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=0, ";
configs += "width= "+w+", height="+h;
props=window.open(output, 'poppage', configs);
}
<a href="javascript: popUp5('images/pics/glencontroller.gif',400,500)">Pic 4</a>
<a href="javascript: popUp5('images/pics/anothergif.gif',100,200)">Pic 4</a>
<a href="javascript: popUp5('images/pics/troll.gif',40,40)">Pic 4</a>
<a href="javascript: popUp5('images/pics/glencontroller2.gif',425,525)">Pic 4</a>
Dirk Lance
11-19-2002, 05:02 PM
i wouldn't say not wanting to create 354 seperate html pages just for images is being lazy (just server space conscious).
thanks for the encouraging words though.
kdjoergensen
11-19-2002, 05:11 PM
You are not creating 354 seperate pages. You are dynamically creating one (1) page every time you call the function.
You do not have to create seperate html pages .. the script will write a page to the new window. in this dynamic page you can have regular style information and html tags just as you have in hard coded pages.
The script I have you writes the page dynamically, and does not require you to have seperate pages.
That was the reason I wrote: are you lazy ? You would only have to create the page information once (I did it for you). Maybe I misunderstood your original question...
you asked if there was a way to set the margins to none without creating a seperate .htm page. My answer was: no, you will have to create the page (e.g. <html><head> and <body> tags) to get that kind of information, but this page is coded once and then dynamically written to the page every time you click on the links. E.g. no reason to have seperate webpages on your server.
Write once, use many times, life is good, beer is cheap (I will now crawl back under the rock I came from).
Dirk Lance
11-19-2002, 08:12 PM
i see.
thanks dude=:O
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.