Jump to content

Margins On Popups


DarkSoul520

Recommended Posts

Is this post continued from somewhere else? I'm totally lost!A link to the code in action(helpful), posting the actual code (not as helpful) or important parts (helpful when combined with link to working pages) would be nice.In general you can affect margins using css attribute called... hey, what do ya know... marginLook in the css reference or tutorials for more.Until I know more what you are talking about I can't be much help...

Link to comment
Share on other sites

  • 3 months later...

God, I am really sorry for replying so late. I forgot I had the link to this site. :) I have huge white margins on the top, bottom, left, and right of my image I am linking too.Heres my coding.In Heading

<script language="JavaScript">function openNewWindow(URLtoOpen, windowName, windowFeatures) {newWindow=window.open(URLtoOpen, windowName, windowFeatures);}

And this in the body

<a href="javascriptopenNewWindow('http://i21.photobucket.com/albums/b285/DarkSoul520/Current%20Pics/2006/4_18_06.jpg','4_18_06','height=446,width=576,toolb ar=no,scrollbars=no,margin=0')"><img src="http://i21.photobucket.com/albums/b285/DarkSoul520/Current%20Pics%20Preview/2006/4_18_06.png" alt="" height="74" width="81" border="0"></a>

Link to comment
Share on other sites

I struggled with this problem for a long time a while ago and decided I wasn't going to make an html page for each window so I just made one html page with a blank img tag and every time I opened that html page in the window and substituted the blank img tag for whatever src image I wanted. Try that.

Link to comment
Share on other sites

<a href="javascript:openNewWindow('http://i21.photobucket.com/albums/b285/DarkSoul520/Current%20Pics/2006/4_18_06.jpg','4_18_06','height=446,width=576,toolb ar=no,scrollbars=no,margin=0')"><img src="http://i21.photobucket.com/albums/b285/DarkSoul520/Current%20Pics%20Preview/2006/4_18_06.png" alt="" height="74" width="81" border="0"></a>
You forgot the colon sign after the java script: :)
Link to comment
Share on other sites

When I link to an image using a popup, there are huge margins on the top and left of the image on the pop up.How do I get rid of this?
This is a css problem, so basically your going to have to write some style properties to the new window along with your picture, namely margin:0px.This should do the job :)
<script language="JavaScript">function openNewWindow(URLtoOpen, windowName, windowFeatures) {newWindow=window.open("", windowName, windowFeatures);contents="<body style='margin:0px;'><img src='"+URLtoOpen+"' /></body>";newWindow.document.write(contents); }</script>

Link to comment
Share on other sites

that doesn't work for me ^ .. here what i have:

function launchImage() {	var url = document.fullimage.src;	var contents = '<html><body style="margin:0px;"><img src="'+url+'" /></body></html>';	imagewindow = window.open(url,'imagelaunch','scrollbars=no,resizable=no,toolbar=no,location=no,status=yes,menubar=no');	imagewindow.document.write(contents); }

but that doesn't work :S

Link to comment
Share on other sites

This is a css problem, so basically your going to have to write some style properties to the new window along with your picture, namely margin:0px.This should do the job  :)
<script language="JavaScript">function openNewWindow(URLtoOpen, windowName, windowFeatures) {newWindow=window.open("", windowName, windowFeatures);contents="<body style='margin:0px;'><img src='"+URLtoOpen+"' /></body>";newWindow.document.write(contents); }</script>

I pasted that where my old code was and it didn't work.And asylum, could you explain more of what you are talking about?
Link to comment
Share on other sites

I pasted that where my old code was and it didn't work.
It works fine for me, well i can only test it on IE right now and it works in that, try this link.http://scott100.atspace.com/NewWindow.htmEDIT did you remember and put the : after javascript? Edited by scott100
Link to comment
Share on other sites

Just make a blank html page that contains an image tag with no src. Then when you want to display an image in a new window open that html page instead and then rewrite the src of that img tag in the page to be the src of the desired image.Does that make more sense?

Link to comment
Share on other sites

Is there something wrong with freewebs?  :)
I don't know if something is wrong but they are adding in an external javascript to your code which is causing the error.function openNewWindow(URLtoOpen, windowName, windowFeatures) {newWindow=window.open("", windowName, windowFeatures);contents="<body style='margin:0px;'><img src='"+URLtoOpen+"' /><!-- --><script type="text/javascript" src="/i.js"></script></body>";newWindow.document.write(contents); }
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...