Is it possible to write a script so that when the page is updated another code appears, for example, like this:

<div id="vk_poll1"></div> <script type="text/javascript"> VK.Widgets.Poll("vk_poll1", {width: "200"}, "11578523_5ed71790f94fe22de7"); </script> 

And when you refresh the page:

 <div id="vk_poll"></div> <script type="text/javascript"> VK.Widgets.Poll("vk_poll", {width: "200"}, "13362052_b154dc799a25937507"); </script> 
  • @doove, If you get a worthwhile answer, mark it as accepted. - Nicolas Chabanovsky

1 answer 1

Sure you may.

  <script type="text/javascript"> polls=['"11578523_5ed71790f94fe22de7"','"13362052_b154dc799a25937507"']; poll_num=Math.floor(Math.random()*polls.length); VK.Widgets.Poll("vk_poll", {width:"200"},polls[poll_num]); </script> 
  • mb I did not understand something, but it doesn’t work: ( - doove
  • Displayed but Wrong poll_id is writing - doove
  • try removing double quotes from the array. - stck
  • Daaaaaaaaa! Thank you so much! - doove
  • For thanks, there is a button - stck