I'm trying to get Dialogue Boxes with GO Buttons to open links in a new tab. I've successfully gotten regular dialogue boxes to achieve this, as seen on http://www.voy.com/230247/ . Example #2 is a dialogue box which allows links to open in new tab. Meanwhile, example #3 is the type of dialogue box using the GO button. I would like these links to open in a New tab, as well. So, I'd like to know how this can be done. Thanks.
Asked
Active
Viewed 718 times
0
-
Change the GO button to a link. Then style the link as a button. Then follow the advice from this answer: http://stackoverflow.com/a/5554031/115139 – Geoffrey Mar 12 '15 at 20:33
-
yea. There were several different methods which enabled me to open the link in a new tab. Although, in every case, this always happened before the button was pressed. (the 3rd example in my link page). I'm not even sure if it's possible to provide the desired function. But, it would be great since I love the GO button example, but I want to keep my base page (voy 230247) active while clicking new links. – Media Reform Mar 13 '15 at 00:07
1 Answers
0
Same way as you did before:
<input onclick="if(myList.selectedIndex>0){window.open(myList.options[myList.selectedIndex].value, "_top")} else{alert('Choose a Site.')}" type="button" value="Go!" />
This is the key part:
window.open(myList.options[myList.selectedIndex].value, "_top")
Note: I have never used _top
myself, I am trusting your code. I have always used: "_blank"
myself.

cssyphus
- 37,875
- 18
- 96
- 111
-
interesting stuff. My biggest goal is waiting until the GO BUTTON is pressed before opening my link in a new tab. (I'm referring to the 3rd example on the site http://voy.com/230247/ . I've been able to get links to open in a new tab. But it always happens before I press the GO button. So, that seems to be a major obstacle. and it's probably beyond my knowledge of Javascript or query, or css3. – Media Reform Mar 12 '15 at 23:57
-
You pretty much got it -- It works just like I said in above answer. See this working jsFiddle: http://jsfiddle.net/khmwyavx/1/ – cssyphus Mar 13 '15 at 00:25
-
Hey thanks. That was amazing. It looks like I had one missing parenthesis. This worked like a charm. and, if you return to the page, http://voy.com/230247/ and scroll closer to the bottom, you'll also see a few projects I've been working on, using the GO Button feature. So obviously, this has been an important thing for me. Thanks again. – Media Reform Mar 13 '15 at 00:51
-
You're welcome. It would be great if you would accept the answer if we have solved your problem. Best wishes with your project. – cssyphus Mar 13 '15 at 00:57
-
It says I need a 15 reputation in order to vote up an answer. :( sorry! – Media Reform Mar 13 '15 at 00:59
-
Thanks for thinking of upvoting - kind of you. To accept the answer, and close the question, you just click the checkmark beside the answer (it will turn green). Best regards. – cssyphus Mar 13 '15 at 01:42