Random Facts Box

"Random Facts" / "Did you know" Box

Did you know???

    1. Locate the random-box.js block in the “2017 Design Master” > “js-2017”.
    2. Right-click and copy the block.
    3. Move the copied block over to your own site directory’s included “js folder”. You can then proceed to edit the script on your site as needed.

      <script>
      var item = new Array (); item[0] = "<p>This guy said \"some stuff\"?</p>";
      item[1] = "<p><img src='img/btn/right-banner/Web-Banner-Achieve1.jpg' alt='Help Students
      Achieve' width='220px' height='400px' class='image' /></p>";
      item[2] = "Western has twelve Faculties and Schools and three Affiliated University Colleges?";
      item[3] = "<p><img src='img/btn/right-banner/Web-Banner-Achieve1.jpg' alt='Help Students Achieve' width='220px' height='400px' class='image' /></p>";
      item[4] = "The University of <a href='www.uwo.com'>Western Ontario</a> is one of the oldest and most beautiful universities in Canada?";
      item[5] = "that Western has five Rhodes Scholars in the past nine years, as well as four Goldman Sachs award winners in the past four years?";
      var i = Math.floor(item.length*Math.random());
      document.write(item[i]);
      </script>

      In the actual .js script block, edit the content items. You can add as many items as you wish, just remember to add the numbers in the square brackets. Use the proper format:

      Use single quotes in any place inside the initial double quotes or it breaks the Script. EXAMPLE:

      item[5] = "Western University is getting a new webpage design, check it out <a href='www.uwestern.ca'>here</a>"

      If you need double quotes, for instance, to include quotes by  students, you need to use an escape character, so instead of:

      item[4] = "This guy said "some stuff"";

      it would have to be

      item[4] = "This guy said \"some stuff\"";

    4. Once you have finished editing your JavaScript block, you must add it to every page where you intend to use it. To accomplish this:

      Open the relevant page, go to “Edit” > “Configure” in the top menu.

      Scroll through the regions listed until you find five JavaScript regions.

      Click “Choose Block” on an empty path and load the corresponding block from your site’s directory.

      In the WYSIWYG source code editor insert the following script:

      <div class="grey-box">
      <h3>Did you know???</h3>
      <script src="js/random-box.js" type="text/javascript" language="javascript"></script>
      </div>

    You only need to edit the js block in your directory and your changes will be applied to all pages using the random-box