I have a piece of html/javascript that need to be opened in a new page, but I'm using Wix.com

Random User55
<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.

Geoff James

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

I have a multi-line string that I need to iterate over, but I'm not using bash. Advice?

From Dev

How can I redirect a page to previous url from new url that is opened using window.location.href on clicking exit button?

From Dev

Do I need to have a checksum if I am using GZIP?

From Dev

I build a select and i need when i refresh the page he shows what i have select before

From Dev

i'm doing a script but i have an issue with page loading

From Dev

I want to load the page content (in a DIV) dynamically using a hashbang URL (blah.com/#!/thingtoload), I have jQuery and Bootstrap

From Dev

Using gparted, what do I need to do to make a new partition that will have all of the unused space available to that 3rd partition?

From Dev

Do I need less.js if I'm using dotless?

From Dev

Do I need to use Reachability if I'm using Parse?

From Dev

I have a signup issue with linking a submit button to a new page

From Dev

Do I need volatile when timing a piece of code?

From Dev

I need help trying to understand this piece of code about structures and pointers

From Dev

I have some remote images I'm loading into an NSMutableArray but the array isn't populated by the time I need it

From Dev

When using WiX, what should I supply for INSTALLDIR if I'm installing a Windows exe and a Web App?

From Dev

I have a JSON response and I'm stuck on using it

From Dev

I have a substring that works but sometime the word that i'm using is not in the comment

From Dev

I have following piece of code to stop media player

From Dev

i need to return an entire html page using an ajax call

From Dev

Using CSS only I need to hide a DIV on 1 page only

From Dev

Using ImageMagick I need to splice half of two images into a new image

From Dev

Can I have one piece of a flash drive dedicated to just files whereas the other piece is a bootable file system?

From Dev

I have this message on my terminal as soon I opened

From Dev

I have configured a vagrant file, and I need a dev.domain.com pointing to 55.55.55.5/public

From Dev

How can I replace opened brackets from end of line to new line using sed?

From Dev

PHP solution: I have a page that I get with post but need to delay some code until the page has posted - codeigniter

From Dev

process is not using new open file configuration which I have set?

From Dev

I have a piece of server-client code, however this bit is in AS3 and I'm working in C#. Can someone help me translate it?

From Dev

I need help solving a simple exercise (I'm new, so it's all like heiroglyphics to me)

From Dev

I'm new to starting a server on my own. I need advice on what to do

Related Related

  1. 1

    I have a multi-line string that I need to iterate over, but I'm not using bash. Advice?

  2. 2

    How can I redirect a page to previous url from new url that is opened using window.location.href on clicking exit button?

  3. 3

    Do I need to have a checksum if I am using GZIP?

  4. 4

    I build a select and i need when i refresh the page he shows what i have select before

  5. 5

    i'm doing a script but i have an issue with page loading

  6. 6

    I want to load the page content (in a DIV) dynamically using a hashbang URL (blah.com/#!/thingtoload), I have jQuery and Bootstrap

  7. 7

    Using gparted, what do I need to do to make a new partition that will have all of the unused space available to that 3rd partition?

  8. 8

    Do I need less.js if I'm using dotless?

  9. 9

    Do I need to use Reachability if I'm using Parse?

  10. 10

    I have a signup issue with linking a submit button to a new page

  11. 11

    Do I need volatile when timing a piece of code?

  12. 12

    I need help trying to understand this piece of code about structures and pointers

  13. 13

    I have some remote images I'm loading into an NSMutableArray but the array isn't populated by the time I need it

  14. 14

    When using WiX, what should I supply for INSTALLDIR if I'm installing a Windows exe and a Web App?

  15. 15

    I have a JSON response and I'm stuck on using it

  16. 16

    I have a substring that works but sometime the word that i'm using is not in the comment

  17. 17

    I have following piece of code to stop media player

  18. 18

    i need to return an entire html page using an ajax call

  19. 19

    Using CSS only I need to hide a DIV on 1 page only

  20. 20

    Using ImageMagick I need to splice half of two images into a new image

  21. 21

    Can I have one piece of a flash drive dedicated to just files whereas the other piece is a bootable file system?

  22. 22

    I have this message on my terminal as soon I opened

  23. 23

    I have configured a vagrant file, and I need a dev.domain.com pointing to 55.55.55.5/public

  24. 24

    How can I replace opened brackets from end of line to new line using sed?

  25. 25

    PHP solution: I have a page that I get with post but need to delay some code until the page has posted - codeigniter

  26. 26

    process is not using new open file configuration which I have set?

  27. 27

    I have a piece of server-client code, however this bit is in AS3 and I'm working in C#. Can someone help me translate it?

  28. 28

    I need help solving a simple exercise (I'm new, so it's all like heiroglyphics to me)

  29. 29

    I'm new to starting a server on my own. I need advice on what to do

HotTag

Archive