Html Help!

Posted:
in Genius Bar edited January 2014
I've got a webpage that I'm working on. When you click on the image,

this page pops open as a new window.



What I want to do is to click on the large picture to close the new window

that was created. I've been looking online for the code to do this with no

luck.



Any help would be appreciated.



Comments

  • Reply 1 of 1
    jayhighjayhigh Posts: 40member
    Try using this.



    Use this anchor tag to open the new window:

    Code:


    <a href="#" onclick="window.open('page_url', 'window_name')">Text</a>





    Don't forget to change the variables page_url and window_name respectively.



    And use this to close the window:

    Code:


    <a href="#" onclick="window.close()">Image Tag</a>





    You said you wanted your visitors to be able to close the window by clicking on the image? Well, this will make the image a "link" and close it instead.



    Good luck with your site.
Sign In or Register to comment.