Results 1 to 2 of 2

Thread: image --> onclick --> href to target

  1. #1
    Join Date
    Nov 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile image --> onclick --> href to target

    I think title says it all.
    I need help, I am trying to use an onclick function (on an image), to open an html file in a certain target...

    How can I archive this??

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You don't even need javascript for that, although it can be used. Without javascript:

    HTML Code:
    <a href="whatever.htm" target="whatever"><img border="0" src="some.jpg" alt=""></a>
    With javascript, there are many, many possibilities. The most basic is:

    HTML Code:
    <a onclick="window.open(this.href,this.target);return false;" href="whatever.htm" target="whatever"><img border="0" src="some.jpg" alt=""></a>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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