BHCOM
BHCOM

Reputation: 124

Append Random Number to URL in Script

I am trying to append a random number Math.floor((Math.random() * 10000) + 1);

To an embedded Formstack Form such as this one:

<script type="text/javascript" src="https://brynhowlett.formstack.com/forms/js.php/starbucks_orders__copy&"></script>

Int needs to go at the end right after the "&". I almost had it but keep messing up. I just need a push in the right directions.

Also I need it to be all inline. So I guess I would add the following above it the embedded form.

<script type="text/javascript" 

JS goes here

</script>

Upvotes: 0

Views: 4001

Answers (1)

guest271314
guest271314

Reputation: 1

Try using document.open() , document.write() , document.close()

<script>
  document.open();
  document.write("<script src=https://brynhowlett.formstack.com/forms/js.php/starbucks_orders__copy&" + Math.floor((Math.random() * 10000) + 1) + "><\/script>");
  document.close();
</script>
<body>
</body>

Upvotes: 2

Related Questions