JSFiddle - React, Tailwind, and code Playground
by arjankuijpers
HTML
<a id="link"> click here to open new tab</a><br><br>
<a id="boolLink">click here to switch</a><br>state: <a id="status"/>
JavaScript
var linkRef = document.getElementById("link");
var boolLinkRef = document.getElementById("boolLink");
var statusRef = document.getElementById("status");
var boolBlank = false;
//ignore this, its setting the boolLabel.
statusRef.innerHTML = "Window";
linkRef.onclick = function()
{
var windowObjectReference;
var strWindowFeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes";
var url = "http://google.com";
if(boolBlank) //tab
{
window.open(url,'_blank');
}
else // window
{
window.open(url, "test", strWindowFeatures);
}
}
//not important from here
boolLinkRef.onclick = function()
{
boolBlank =!boolBlank; //switch
if(boolBlank) { statusRef.innerHTML = "Tab";}
else { statusRef.innerHTML = "Window";}
}