PDA

View Full Version : [Q] How to center a image with JavaScript when opening a new window


CyanBlue
05-08-2002, 07:22 PM
Hi...

I'm just trying to understand how this JavaScript works and how to use on my project at the same time...
What I want to do with JavaScript is to open a new popup window with no titlebar or any other things, and load one of my JPEG file in it... I can do that by using this one... and I am calling this function from Flash 5 using getURL() function...


code:
--------------------------------------------------------------------------------

function Card1()
{
window.open('Images/Card1_Big. jpg','Trading_Card','width=300,height=200,resizabl e=no,scrollbars=no,toolbar=no,location=no,director
ies=no,status=no,menubar=no');
}


--------------------------------------------------------------------------------

Now, what I want to do is to see if it is possible to load that Card1_Big.jpg centered horizontally and vertically without using seperate html files for each JPEG files... And is it possible to load without the titlebar, minimize, and maximize buttons???
When that is done, I'd like to change that Card1 function in a way that I can pass a JPEG file name, width and height so that I can have just one Card function rather than 100s of that functions, but I am not there yet... I gotta go do some more reading on that part...
I'd appreciate all the help I can get...

TIA
Jason

PS> Somehow the file name in that Card1 function got one space when previewing this posting, but I don't have any space and it works just fine...

mad_A
05-09-2002, 02:57 PM
why write the function on that page so that it rewrites itself with the image inside it?

As far as I know that is the only way. I don't think you can centre an image without html.

But you can use javascript to say:

function rewrite(image){
document.write("<html><HEAD><TITLE>Image</TITLE></HEAD><BODY>
<img src=" + image +" width='788' height='548' align='absmiddle'></BODY></HTML>");

}