Pop Up And New Page Code?

3 replies
If you go to this site :http://www.retailmenot.com/view/jcpenney.com
and if you click on one of those coupons it opens new window tab and pop up window with the coupon code.

I am trying to make something similar. I am not a programmer so i searched for possible solutions and i'v found this code:

<a href="http://www.yahoo.com" onclick="javascript:void window.open('http://www.yahoo.com','1351633016625','width=250,height=5 00,toolbar=0,menubar=0,location=0,status=1,scrollb ars=1,resizable=1,right=0,top=0');return false;">Pop-up Window</a>

or you can see it in action here: Pop

What i am trying to make is to add or change something in the code so when i click on it, it should open a new window tab(with different site, for example google.com) and in pop up window to be yahoo.com. Is there any way to add something or change in this code to achieve this result?
#code #page #pop
  • Profile picture of the author Sergiu FUNIERU
    How about this?
    Code:
    <a href = "#" target = "_blank" onclick="javascript:void window.open('http://www.yahoo.com','1351633016625','width=250,height=5 00,toolbar=0,menubar=0,location=0,status=1,scrollb ars=1,resizable=1,right=0,top=0'); window.open('http://www.google.com', 'blank'); return false;">Pop-up Window</a>
    I added the bolded part and replaced what was after href with the # sign.

    It worked on my computer.

    Sergiu FUNIERU
    {{ DiscussionBoard.errors[7270856].message }}
    • Profile picture of the author NicolasDaVinci
      Thanks, it works, is there any way this pop up(yahoo) to be in front of new window tab (google)?
      {{ DiscussionBoard.errors[7272380].message }}
  • Profile picture of the author Sergiu FUNIERU
    >>> Thanks
    You're welcome.

    >>> is there any way this pop up(yahoo) to be in front of new window tab (google)?
    Well, in Firefox 3.6, even the code from my previous reply works the way you want. But, the version below works even in Chrome and IE 7.

    I opened the google window first, and I changed "top" property for the yahoo window, from 0 to 1. I also removed the void word which was after "javascript" - I'm not sure why it was there.

    Here's the new code. Please confirm if that's what you had in mind.
    Code:
    <a href = "#" target = "_blank" onclick="javascript: window.open('http://www.google.com', 'blank'); window.open('http://www.yahoo.com','1351633016625','width=250,height=5 00,toolbar=0,menubar=0,location=0,status=1,scrollb ars=1,resizable=1,right=0,top=1'); return false;">Pop-up Window</a>
    Sergiu FUNIERU
    {{ DiscussionBoard.errors[7272769].message }}

Trending Topics