<script type="text/javascript">
function randomlinks() {
var myrandom = Math.round(Math.random() * 5)
var links = new Array()
links[0] = "wix website here"
links[1] = "wix website here"
links[2] = "wix website here"
links[3] = "wix website here"
links[4] = "wix website here"
links[5] = "wix website here"
window.location = links[myrandom]
}
</script>
<form>
<input button type="button" value="Start Taking Notes!" onClick="randomlinks()">
</form>
This is the code that I have in wix right now. I have replaced the links to the website for obvious reasons and replaced it with "wix website here." I hope some one can help me figure out where to put a piece of code to open these links in a new tab.
Edit: I should also put that right now when I click the button to bring me to the links they are opening in wix's custom built iframe.
You should use the window.open()
method, and set the "target" to "_blank" - this is the equivalent of setting an <a target="_blank">
, but through JS:
Replace your window.location=links[myrandom]
, with:
window.open(links[myrandom], "_blank");
And this should work fine :)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments