a <A HREF=...> question

liunx

Guest
i am using the following link:

<A HREF=http://www.webdeveloper.com/forum/archive/index.php/"a1.jpg">Picture 1</A>

to view some pictures. This causes them to open into another window, but it doesnt give you control over the background or size of the pic. What i would like to do is have the pic open in a window where its centered with a black background. with maybe a "close" or "back" link under the pic. now, do i have to write a page for each pic and link it to the page or can you have each pic go to the same page and maintain that format or maybe have it do it automatically or whatever. any advice?

thanks guys,

WarOriginally posted by warbishop
i am using the following link:

<A HREF=http://www.webdeveloper.com/forum/archive/index.php/"a1.jpg">Picture 1</A>

to view some pictures. This causes them to open into another window
That's a pretty good trick ... or are you leaving out part of the story (there is nothing in that link that will cause a browser to open the picture in another window)?
What i would like to do is have the pic open in a window where its centered with a black background. with maybe a "close" or "back" link under the pic. now, do i have to write a page for each pic and link it to the page or can you have each pic go to the same page and maintain that format or maybe have it do it automatically or whatever.
Take a look at <!-- m --><a class="postlink" href="http://gil.davis.home.att.net/shuttle4.htm">http://gil.davis.home.att.net/shuttle4.htm</a><!-- m --> and click on one of the patches. I open a window and use document.write() to build the page so that I can control the size and position of the window and give it a title. It has a black background and has a "please wait while loading" message. You could add the buttons you want to the document.write() part of the script fairly easily.

If you like the idea, here are the files you need:
<!-- m --><a class="postlink" href="http://gil.davis.home.att.net/openit.js">http://gil.davis.home.att.net/openit.js</a><!-- m -->
<!-- m --><a class="postlink" href="http://gil.davis.home.att.net/openit.csswell">http://gil.davis.home.att.net/openit.csswell</a><!-- m -->, you r right, its the same window, but the question remained the same. sorry im not a html God. when i ask questions, i ask them the best i can... you kinda have to allow a little latitude.

if my questions irritate you, just dont reply. lol

warOriginally posted by warbishop
if my questions irritate you, just dont reply.
I suppose I should have used one of those smiley things.

I assumed there was either more to what you were asking, or knew something that I did not.

My suggestion opens a new window. I made that suggestion based on your statement. Do you want the picture in a new window (like my page), or in the same window?i saw your page and i saw kinda what you did. i like the way it opens in a new window like you said but i need to control the background in the new window too and canter the pic and control its size with some sort of width and height command.

can i alter it to accomodate that?


warOriginally posted by warbishop
i need to control the background in the new window too and canter the pic

You can do that with CSS

Center the pic is done by

<body style="text-align:center">

Fow what you can do with backgrounds read here
<!-- m --><a class="postlink" href="http://www.w3.org/TR/REC-CSS2/colors.html#q2Originally">http://www.w3.org/TR/REC-CSS2/colors.html#q2Originally</a><!-- m --> posted by warbishop
i need to control the background in the new window too and canter the pic and control its size with some sort of width and height command.
What I did sizes and centers the window according to the image size, so you don't see any background.

Why don't you create an example page with your buttons and background and the image centered and post it so we know what you are talking about? Then it can be adapted to work without making a page for every image.

Also, it would be pretty easy to build a page with a blank place holder image and then change the source of that image to the one that is clicked.

There are lots of possibilities.here is the comman that i copied from your page gil and tried to alter it accordingly, but it deosnt seem to work for me. i must be missing something. what can i do to it get the desire effect. if it will show only the image and keep it in th3 next window, that would be fine. kind alikes yours, i noticed yours does crop the excess window down to the image size. thats cool.

<a href=http://www.webdeveloper.com/forum/archive/index.php/"myimage.jpg" target='_blank' onClick='openit(this.href, "pic page 1"); return false'>click here</a>

what am i mssing?

warMinimum example:

<html>
<head>
<title>Demo</title>
<script type="text/javascript" src=http://www.webdeveloper.com/forum/archive/index.php/"openit.js"></script>
</head>
<body>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"myimage.jpg" target="_blank" onClick='openit(this.href, "pic page 1"); return false'>click here</a>
</body>
</html>Originally posted by gil davis
Minimum example:


If anyone is interested, a minimal valid version would look something like this :)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<title>Demo</title>
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript" src=http://www.webdeveloper.com/forum/archive/index.php/"openit.js"></script>
<p>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"myimage.jpg" target="_blank" onclick='openit(this.href, "pic page 1"); return false'>click here</a>i cant get this to work, i try but it only opens in the new widow. not the window where it is eaxctly the same size as the pic like gils. im stumped... somebody isnt telling me something.

i dont know

warDoes the image exist in the same directory as the page?but the new window doesnt just outline the pic, it is about twice the size of the picPost a link.I found some conditions where the script failed. I'm not sure they have any relation to your problems, but I have corrected it if you want to try again.

<!-- m --><a class="postlink" href="http://gil.davis.home.att.net/openit.js">http://gil.davis.home.att.net/openit.js</a><!-- m -->
<!-- m --><a class="postlink" href="http://gil.davis.home.att.net/openns.css">http://gil.davis.home.att.net/openns.css</a><!-- m -->
<!-- m --><a class="postlink" href="http://gil.davis.home.att.net/openit.css">http://gil.davis.home.att.net/openit.css</a><!-- m -->
 
Top