Random Facts Box
Did you know???
- Locate the random-box.js block in the “2017 Design Master” > “js-2017”.
- Right-click and copy the block.
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>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:
var item = new Array (); item = "<p>This guy said \"some stuff\"?</p>";
item = "<p><img src='img/btn/right-banner/Web-Banner-Achieve1.jpg' alt='Help Students
Achieve' width='220px' height='400px' class='image' /></p>";
item = "Western has twelve Faculties and Schools and three Affiliated University Colleges?";
item = "<p><img src='img/btn/right-banner/Web-Banner-Achieve1.jpg' alt='Help Students Achieve' width='220px' height='400px' class='image' /></p>";
item = "The University of <a href='www.uwo.com'>Western Ontario</a> is one of the oldest and most beautiful universities in Canada?";
item = "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());
Use single quotes in any place inside the initial double quotes or it breaks the Script. EXAMPLE:
item = "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 = "This guy said "some stuff"";
it would have to be
item = "This guy said \"some stuff\"";
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:
<h3>Did you know???</h3>
- You only need to edit the js block in your directory and your changes will be applied to all pages using the random-box