jquery - Randomly change javascript popup code -


I have three different pop up ads JavaScript code that has been uploaded to my site. I want to create a JavaScript program that will randomly alter each page once a page is loaded. How do i do this

Script 1

  & lt; script type = "text / javascript" & gt; Var uid = '12 9 46'; Var wid = '23707'; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "http://cdn.pop.net/pop.js" & gt; & Lt; / Script & gt;   

Script2

  & lt; Script type = "text / javascript" & gt; Var UID = '22333'; Var wid = '234333'; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "http://cdn.pop.net/pop.js" & gt; & Lt; / Script & gt;   

script 3

  & lt; script type = "text / javascript" & gt; Var UID = '14444'; Var wid = '23444'; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "http://cdn.pop.net/pop.js" & gt; & Lt; / Script & gt;  

This randomly chooses one of the 3 combinations given by you. ..

  & lt; script type = "text / javascript" & gt; Var i = Math.floor (Math.Random) * 3); Var UID = ["12 9 46", "22333", "14444"] [I]; Var wid = ["23707", "234333", "23444"] [i]; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "http://cdn.pop.net/pop.js" & gt; & Lt; / Script & gt;    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -