title: how to make random text change without reloading the page
body: <p>right now i have this script that gives users a random word..
  however the only way to get a new word is to refresh the page...</p>
  
  <p>i would like to be able to set the words to change at a specific interval rather then having to reload the page or browser but i have no idea how to do the and ive been reading forever and cant seem to figure it out</p>
  
  <p>here is my php code</p>
  
  <pre><code>&lt;?php
  /* File, where the random text/quotes are stored one per line */
  $settings['text_from_file'] = 'quotes.txt';
  /*
   * If you prefer you can list quotes that RanTex will choose from here.
   * In this case set above variable to $settings['text_from_file'] = '';
   */
  $settings['quotes'] = array(
      'First quote',
      'Multi
  line
  quote',
      'Second quote',
      'Third quote',
      'Some text with &lt;b&gt;HTML&lt;/b&gt; code!',
      'Any single quotes \' must be escaped with a backslash',
      'A quote with a &lt;a href="http://www.phpjunkyard.com"&gt;link&lt;/a&gt;!'
  );
  /*
   * How to display the text?
   * 0 = raw mode: print the text as it is, when using RanTex as an include
   * 1 = Javascript mode: when using Javascript to display the quote
   */
  $settings['display_type'] = 1;
  /* Allow on-the-fly settings override? 0 = NO, 1 = YES */
  $settings['allow_otf'] = 1;
  // Override type?
  if ($settings['allow_otf'] &amp;&amp; isset($_GET['type'])) {
      $type = intval($_GET['type']);
  } else {
      $type = $settings['display_type'];
  }
  // Get a list of all text options
  if ($settings['text_from_file']) {
      $settings['quotes'] = file($settings['text_from_file']);
  }
  // If we have any text choose a random one, otherwise show 'No text to choose from'
  if (count($settings['quotes'])) {
      $txt = $settings['quotes'][array_rand($settings['quotes'])];
  } else {
      $txt = 'No text to choose from';
  }
  // Output the image according to the selected type
  if ($type) {
      // New lines will break Javascript, remove any and replace them with &lt;br /&gt;
      $txt = nl2br(trim($txt));
      $txt = str_replace(array(
          "\n",
          "\r"
      ), '', $txt);
      // Set the correct MIME type
      header("Content-type: text/javascript");
      // Print the Javascript code
      echo 'document.write(\'' . addslashes($txt) . '\')';
  } else {
      echo $txt;
  }
  ?&gt;
  </code></pre>
  
  <p>here is the javascript on my .html page that calls the php code</p>
  
  <pre><code>&lt;script type="text/javascript" src="randomword.php?type=1"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Right now i get a new word evertime the page reloads but i would like the word to change every 5 seconds without having to refresh the page..... can anyone show me what my code should like?</p>