SitePoint Sponsor |
|
User Tag List
Results 1 to 11 of 11
-
Apr 22, 2002, 01:18 #1
- Join Date
- Nov 2000
- Location
- Chico, Ca
- Posts
- 1,125
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Pop up windows in JS with no margin..
I am using popup windows.. to display some images, but I can't seem to figure out how to get rid of the left and top margins in the windows.. I am sure this is pretty simple. Can someone help me out ?
Thanks
CHuck"Happiness doesn't find you, you find happiness" -- Unknown
www.chuckknows.com
-
Apr 22, 2002, 01:51 #2
- Join Date
- Aug 2001
- Location
- London
- Posts
- 2,475
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
for sum reason i could not pass the style to the popup, but this works anyway.
PHP Code:<script>
x = window.open ('','','');
x.document.write ('hello<script>document.body.style.margin = \'0px 0px 0px 0px;\';</script'+'>');
</script>
-
Apr 22, 2002, 01:53 #3
- Join Date
- Nov 2000
- Location
- Chico, Ca
- Posts
- 1,125
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is there not a way to put style in the javascript popup window? Or is there a way that I use a template to load the images into?
If I where to make an html file for every pop up .. I would have to make over a 100 html pages to hold one image each.
Thanks
Chuck"Happiness doesn't find you, you find happiness" -- Unknown
www.chuckknows.com
-
Apr 22, 2002, 01:56 #4
- Join Date
- Aug 2001
- Location
- London
- Posts
- 2,475
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
look up
-
Apr 22, 2002, 02:16 #5
- Join Date
- Nov 2000
- Location
- Chico, Ca
- Posts
- 1,125
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Could I get a wee bit more help?
this is the head:
Code:<script language="JavaScript"> <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script>
and the actual link
Code:<a href="#"><img style="border:0"src="images/people/thmnails/image002.jpg" width="120" height="89" onMouseDown="MM_openBrWindow('images/people/images/image002.jpg','cconway.com -Photos','width=480,height=360')"></a>
I am still learning JS...
Thanks
Chuck"Happiness doesn't find you, you find happiness" -- Unknown
www.chuckknows.com
-
Apr 23, 2002, 09:07 #6
- Join Date
- Nov 2000
- Location
- Chico, Ca
- Posts
- 1,125
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I am still having problems with this JavaScript popup window .. and the margins .. anyone have anymore idea's on it?
Thanks
Chuck"Happiness doesn't find you, you find happiness" -- Unknown
www.chuckknows.com
-
Apr 23, 2002, 11:58 #7
- Join Date
- Aug 2001
- Location
- London
- Posts
- 2,475
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
are you linking to your own page or a blank page
if its a blank page use this instead of you top function
PHP Code:<script>
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features)
{ //v2.0
x = window.open(theURL,winName,features);
y = x.document;
y.write('<script>');
y.write('document.body.style.margin = \'0px 0px 0px 0px;\';');
y.write('</scr' + 'ipt>');
}
//-->
</script>
PHP Code:<style>
body
{
margin : 0px, 0px, 0px, 0px;
}
</style>
Last edited by Andrew-J2000; Apr 23, 2002 at 12:02.
-
Apr 23, 2002, 14:03 #8
- Join Date
- Nov 2000
- Location
- Chico, Ca
- Posts
- 1,125
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I am creating a photo gallery with thumbnails .. when you click on an image it popups in a window that fits the image snuggly. But IE Netscape 6 and Mozilla are kind enough to put a left and top margin in their blank windows .. which is causeing me a lot of pain.
I tried your script out .. and I cant get it to work .. I am not sure why.. so I am posting the link to the page with the problem .. if you have time .. could you look at it .. if not .. later tonight I am going to write a java program that will create the html files for me..
Thanks
Chuck
cconway.com/v4/nature.htm"Happiness doesn't find you, you find happiness" -- Unknown
www.chuckknows.com
-
Apr 23, 2002, 15:18 #9
- Join Date
- Oct 2000
- Location
- Nashvegas Baby!
- Posts
- 7,845
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Take a look at this page:
http://www.clockworkdesign.net/
The designer uses a script called gallerypics.js. It opens a new window and dynamically writes HTML to "create" this new window. Part of the HTML includes the body tag with no margins. I realize this might be overkill for what you need but this is the best "pop-up" window script (made for an image) that I've ever seen. The script authors site is www.bugimus.com but I could not find the script on that site.Adobe Certified Coldfusion MX 7 Developer
Adobe Certified Advanced Coldfusion MX Developer
My Blog (new) | My Family | My Freelance | My Recipes
-
Apr 23, 2002, 15:45 #10
- Join Date
- Nov 2000
- Location
- Chico, Ca
- Posts
- 1,125
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Your a god Creole! That works perfectly
... I have spend hours trying to learn JS
enough to write a script that would work ..
Thanks
Chuck
P.S
Thanks, Andrew-J2000 for all your help ..Last edited by Chuckie; Apr 23, 2002 at 15:52.
"Happiness doesn't find you, you find happiness" -- Unknown
www.chuckknows.com
-
Apr 23, 2002, 16:05 #11
- Join Date
- Aug 2001
- Location
- London
- Posts
- 2,475
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
where you have all them divs you might want to think about using this instead
PHP Code:
<script language="JavaScript">
<!--
function openWin(url, w, h)
{
img_dir= 'images/nature/images/';
x = window.open(img_dir+url, '', 'witdth='+w+'height='+h);
}
//-->
</script>
<script>
for (i=0,j=15;i<=j;i++)
{
if (i<10) document.write ('<div class="pics"><a href="#"><img style="border:0" src="image00'+i+'.jpg" width="120" height="89" onMouseDown="openWin(\'image00'+i+'.jpg\',480,360)"></a></div>');
else document.write ('<div class="pics"><a href="#"><img style="border:0" src="image0.jpg" width="120" height="89" onMouseDown="openWin(\'image0'+i+'.jpg\',480,360)"></a></div>');
}
</script>
Bookmarks