Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

rotator script

By: a guest on Jan 15th, 2013  |  syntax: HTML  |  size: 1.43 KB  |  views: 848  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <html>
  2. <head>
  3.   <script type="text/javascript" src="jquery.min.js"></script>
  4.   <script type="text/javascript" charset="utf-8">
  5.     var sitesLeft = [
  6.       "http://nagios/url for your nagios",
  7.       "http://prtg graph",
  8.           "http://weather graph",
  9.           "http://another prtg graph"
  10.     ];
  11.         var sitesRight = [
  12.       "http://nagios/url for your nagios",
  13.       "http://prtg graph",
  14.           "http://weather graph",
  15.           "http://another prtg graph"
  16.     ];
  17.     var currentSiteLeft = sitesLeft.length;
  18.     var currentSiteRight = sitesRight.length;
  19.  
  20.     $(document).ready(function () {
  21.       var $iframeLeft = $('iframe[align="left"]').attr("src", sitesLeft[sitesLeft.length - 1]);
  22.       var $iframeRight = $('iframe[align="right"]').attr("src", sitesRight[sitesRight.length - 1]);
  23.       setInterval(function() {
  24.         (currentSiteLeft == 0) ? currentSiteLeft = sitesLeft.length - 1 : currentSiteLeft = currentSiteLeft -1;
  25.         (currentSiteRight == 0) ? currentSiteRight = sitesRight.length - 1 : currentSiteRight = currentSiteRight -1;
  26.         $iframeLeft.attr("src",sitesLeft[currentSiteLeft]);
  27.         $iframeRight.attr("src",sitesRight[currentSiteRight]);         
  28.       }, 35000);
  29.     });
  30.   </script>
  31.   <style type="text/css">
  32.   iframe {
  33.         margin: 0;
  34.   }
  35.   </style>
  36. </head>
  37. <body>
  38.   <iframe align="left" width ="938" height="1050" scrolling="no"></iframe>
  39.   <iframe align="right" width ="938" height="1050" scrolling="no"></iframe>
  40. </body>
  41. </html>