title: Javascript Tab on Focus
body: <p>I currently have the following script that works in the most part however there is a slight modification I would like to make but cannot work how to; I guess with a loop?</p>
  <p><strong>Code:</strong></p>
  <pre><code>&lt;script&gt;
      var message = &quot;Come Back&quot;;
      var original = document.title;
      window.onblur = function() {
          document.title = message;
      }
      window.onfocus = function() {
          document.title = original;
      }
  &lt;/script&gt;
  </code></pre>
  <p>It currently changes the name of a tab to &quot;Come Back&quot; when focus is lost and then reverts to the original message when the tab is selected again.</p>
  <p>I am hoping to add a 2nd &quot;non-focussed&quot; message which the script will switch between every few seconds whilst the tab is not in focus - such as &quot;Come Back&quot;, wait 1 second, &quot;Don't Forget&quot;.</p>