Advertisement
easternnl

Select random link from the page with Javascript

May 30th, 2016
643
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. count = document.getElementsByClassName("portfolio_item").length;
  2. number = 1 + Math.round((Math.random(0) * document.getElementsByClassName("portfolio_item").length));
  3. evalXPath("//div[@id=\"main\"]/div/section/div/ul/li[" + number + "]/div[1]/span/a/span");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement