I'm trying to create a button that links to random websites like on 'The useless web'. I found this code on here and it's worked almost perfectly. I just need help making the sites open in a new tab, at the moment they change the current window. Any help will be greatly appreciated. THANKS
CURRENT:
<script type="text/javascript">
var urls = [
"http://www.kittenwar.com/",
'http://heeeeeeeey.com/',
'http://cat-bounce.com/'
];
function goSomewhere() {
var url = urls[Math.floor(Math.random()*urls.length)];
window.location = url; // redirect
}
onClick handler assigned:
<a href="#" onClick="goSomewhere(); return false;">Gimme something weird!</a>