www.webdeveloper.com
Results 1 to 15 of 15

Thread: a <A HREF=...> question

Hybrid View

  1. #1
    Join Date
    Dec 2002
    Posts
    49

    a <A HREF=...> question

    i am using the following link:

    <A HREF="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,

    War

  2. #2
    Join Date
    Nov 2002
    Posts
    4,473

    Re: a <A HREF=...> question

    Originally posted by warbishop
    i am using the following link:

    <A HREF="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 http://gil.davis.home.att.net/shuttle4.htm 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:
    http://gil.davis.home.att.net/openit.js
    http://gil.davis.home.att.net/openit.css

  3. #3
    Join Date
    Dec 2002
    Posts
    49

    well....

    well, 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

    war

  4. #4
    Join Date
    Nov 2002
    Posts
    4,473
    Originally 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?

  5. #5
    Join Date
    Dec 2002
    Posts
    49

    well..

    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?


    war

  6. #6
    Join Date
    Nov 2002
    Posts
    984

    Re: well..

    Originally 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
    http://www.w3.org/TR/REC-CSS2/colors.html#q2
    // Stefan Huszics

  7. #7
    Join Date
    Nov 2002
    Posts
    4,473

    Re: well..

    Originally 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.

  8. #8
    Join Date
    Dec 2002
    Posts
    49

    i tried but i cant figure what im doing wrong....

    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="myimage.jpg" target='_blank' onClick='openit(this.href, "pic page 1"); return false'>click here</a>

    what am i mssing?

    war

  9. #9
    Join Date
    Nov 2002
    Posts
    4,473
    Minimum example:

    <html>
    <head>
    <title>Demo</title>
    <script type="text/javascript" src="openit.js"></script>
    </head>
    <body>
    <a href="myimage.jpg" target="_blank" onClick='openit(this.href, "pic page 1"); return false'>click here</a>
    </body>
    </html>

  10. #10
    Join Date
    Nov 2002
    Posts
    984
    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="openit.js"></script>
    <p>
    <a href="myimage.jpg" target="_blank" onclick='openit(this.href, "pic page 1"); return false'>click here</a>
    // Stefan Huszics

  11. #11
    Join Date
    Dec 2002
    Posts
    49

    man...

    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

    war
    Last edited by warbishop; 01-05-2003 at 07:46 PM.

  12. #12
    Join Date
    Nov 2002
    Posts
    4,473
    Does the image exist in the same directory as the page?

  13. #13
    Join Date
    Dec 2002
    Posts
    49

    it shows the pic fine...

    but the new window doesnt just outline the pic, it is about twice the size of the pic

  14. #14
    Join Date
    Nov 2002
    Posts
    4,473
    Post a link.

  15. #15
    Join Date
    Nov 2002
    Posts
    4,473

    War, are you still out there?

    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.

    http://gil.davis.home.att.net/openit.js
    http://gil.davis.home.att.net/openns.css
    http://gil.davis.home.att.net/openit.css

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles