I was given this code for adversal. <!-- Begin Publisher Code --> <script src="http://www.adversalservers.com/publisherJS.js"></script> <script type="text/javascript" language="javascript"> initAdversal("8f92b13db33e4e432fe11e4466c5aabb", true); </script> <!-- End Publisher Code --> Code (markup): This displays a full page popup. However, I want to only display it randomly, say a 1 in 10 chance. I would appreciate a code snippet that accomplishes this. The trouble I am having is that I can't randomly display a whole block of javascript like this. Thanks
I don't know Adversal Popups, but you can get a random number between 0 and 9 with something like this: var myRandom = Math.floor( Math.random()*10 ); Code (markup):
Yeah I realize that, and I got this far. <script language="javascript" type="text/javascript"> var ran_number=Math.floor(Math.random()*2); if(ran_number == 1) { } </script> Code (markup): But I can't put the code snippet adversal gave me in the if statement because it requires script tags. Mess around with it and see if you can get it to work, because I can't...
Try this: <!-- Begin Publisher Code --> <script src="http://www.adversalservers.com/publisherJS.js"></script> <script type="text/javascript" language="javascript"> var ran_number=Math.floor(Math.random()*2); if(ran_number == 1) { initAdversal("8f92b13db33e4e432fe11e4466c5aabb", true); } </script> <!-- End Publisher Code --> Code (markup):