Kyle Supe
Kyle Supe

Reputation: 11

have an html link direct someone to another page and pop up another page

I have tried searching for an answer to this but my searches have come up empty handed. Its tough to even figure out what terms to search for. Basically what I have is a list of products. I have the functionality in place where you click the picture and it opens a new tab directing you to an external link where you can buy the product using target =_blank in my a href. I would also like the picture to direct to another internal link where you can comment on and rate the product and just open it in the same tab that the original page is on (so you would essentially have to hit back to return to the main product list. Is this possible to do and if so how? Thanks in advance for any guidance.

Upvotes: 0

Views: 9505

Answers (4)

Starx
Starx

Reputation: 78981

Its pretty simple, use an onclick handler combined with href tags.

<a href="#yourinternallink" onclick="window.open('popup.html')">
   <img src="link/to/my/image.jpg" />
</a>

Upvotes: 0

Konstantin Pereiaslov
Konstantin Pereiaslov

Reputation: 1814

<script type="text/javascript">
   function openpages() {
window.open("http://google.com");
window.location = "http://yahoo.com"
   }
  </script>
<a href=# onclick="openpages()">open product description</a>

This will open Google in a new tab and Yahoo in the same as the link

Upvotes: 1

Pavel Strakhov
Pavel Strakhov

Reputation: 40512

<a href="url for new tab" target="_blank" 
  onclick="location.href = 'url for current tab'">Link</a>

Upvotes: 3

Simon Arsenault
Simon Arsenault

Reputation: 1845

If I understand correctly, you want a link to redirect to a page AND open a popup? Have you tried Javascript's onclick?

You could do something like:

<a href="thePage.html" onclick="window.open('thePopup.html')"><img src="myImage.png"/></a>

Upvotes: 0

Related Questions