May 5, 2012

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

Question by Kyle Supe

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.

Answer by Riateche

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

Answer by Starx

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

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

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+


Please fill the form - I will response as fast as I can!