How do I open Javascript link in new tab?

How do you open a new tab by clicking a button using javascript?

  • Ok, so I'm abit new to javascript and I'm trying to use javascript on my website I'm making. Basically, I want the script to be able to open up a new tab to a different link, i.e facebook.com. But i want the javascript to only run when I click on say a "Go here" button. How would I do that? I've gone through google, but again, i'm new to javascript and have no idea what i'm to change in any of the scripting. So any help would be appreciated greatly.

  • Answer:

    Why do you need javascript for this? You can just use formtarget (if using a form button) or target (if using an anchor tag) that is pointed to _new or _blank. If you must use javascript, do: onclick="javascript:window.open('someth… here')" and use whatever url you need instead.

Dark at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.