Is it possible to put javascript in pages?

Jump to solution
harris60
Community Contributor

I am an instructor so I have 'teacher' level of access on my courses.

I would like to make sure my students see a message. What I would like to do is add a javascript prompt to the home page of my course.

<script>

var MessageRead= "";

do

{

  var MessageRead=prompt("You must schedule your first group meeting with your teammates before September 1. Go to Modules for details.\n\nType yes in the box below to indicate you have read this message.");

}while(MessageRead!="yes");

</script>

I know that the html tool in pages strips out script tags. Is there any way to add my own javascript to a page?

Thanks,

Michael

1 Solution
MattHanes
Community Champion

That is not possible unless you have admin rights to add custom javascript to a particular sub-account.

You can use the following code to add an attention-grabbing box to the top of the home page:

<div class="img-rounded" style="float: right; background-color: #fffbcf; width: 315px; height: 260px; border: 1px solid black; margin: 10px;">

     <h3 style="color: #ffffff; background-color: #2a4e57; text-align: center; margin: 0px; padding: 0px;">

          Announcements

     </h3>

<div id="cc-homepage-announcements" style="height: 200px; overflow-x: hidden; overflow-y: auto; padding: 6px; text-align: left;">

     <p>

          You must schedule your first group meeting with your teammates before September 1st. Go to Modules for details.

     </p>

</div>

</div>

If you want a confirmation they have read that particular requirement, you can create an assignment or quiz that requires them to respond. Then you will know who has or has not seen it based on the gradebook.

View solution in original post