SfC Home > Training > e-Learning >
Explanation of how to use JavaScript alert buttons in developing web based training (WBT). Also refer to Computer-Based Training, CBT, Intranet-Based Training, IBT, plug-ins, ASTD, STC, Ron Kurtus, School for Champions. Copyright © Restrictions
WBT Using JavaScript Alert Buttons
by Ron Kurtus (12 July 1998)
Multiple-choice questions are often used in Computer-Based Training (CBT) to test or verify a learner's knowledge, as well as to keep the person's interest in the lesson.
The advantage of such questions in CBT is that the student can immediately get feedback as to whether the answer was correct and/or what the correct answer is.
A simple way to do this in Web-Based Training (WBT) or Intranet-Based Training (IBT) is to use the alert button feature of JavaScript. This lesson will show examples of using the alert button and provide the JavaScript code.
Check if JavaScript is Available
While most browsers these days can read JavaScript, there still are people with old browsers that can't use this feature. Also, some people may have the function turned off in their browser.
You can use an alert button to let your students check if your multiple choice will work properly with their browsers.
Example of Multiple Choice Quiz
The following multi-choice question is an example of using alert buttons to let the learner know whether the answer was right or wrong, as well as to give some information about the answer.
Unfortunately, this simple method does not let the instructor know how well the student is doing. Rather, it is primarily intended to help the student's learning experience.
1. Why would you use JavaScript for WBT?
JavaScript Code
The following code was used for this example.
<HEAD>
The code placed under the HTML <HEAD> consists of the comments for the various alert windows that pop up after the given button was clicked.
- <script language="JavaScript">
- <!--
- function AlertBox1(){
- alert("Yes, you have JavaScript available.")
- }
- function AlertBox2(){
- alert("Sorry. Multimedia doesn't work well with JavaScript.")
- }
- function AlertBox3(){
- alert("Not right. You need to be on the Web or your Intranet to use JavaScript. Try another answer.")
- }
- function AlertBox4(){
- alert("That is correct. You are a genius.")
- }
- //-->
- </script>
<BODY>
The code for the multiple choice is placed under the <BODY> section, in the area you want the question.
- <p><strong>1. Why would you use JavaScript for WBT?</strong></p>
- <form>
- <div align="left"><p><input type="button" name="B1"
- value="a. So you can do multimedia effects." onclick="AlertBox2()"></p>
- </div><div align="left"><p><input type="button" name="B2"
- value="b. To avoid using the Internet." onclick="AlertBox3()"> </p>
- </div><div align="left"><p><input type="button" name="B3"
- value="c. Most browsers can read JavaScript." onclick="AlertBox4()"></p>
- </div>
- </form>
Summary
Using alert buttons with JavaScript is a useful tool in providing web-based training, although it has its limitations.
See side menu for more e-Learning topics
Teach others
Resources
The following are resources on this subject.
Websites
Books
Mini-quiz to check your understanding
If you got all three correct, you are on your way to becoming a champion in eLearning development. If you had problems, you had better look over the material again.
What do you think?
Do you have any questions, comments, or opinions on this subject? If so, send an email with your feedback. We will try to get back to you as soon as possible.
Also see Answers to Readers' Questions.
Share link
Feel free to establish a link from your website to pages in this site.
Or use our form to send this link to yourself or a friend.
Students and researchers
The Web address of this page is:
www.school-for-champions.com/elearning/jsalert.htm.
Please include it as a reference in your report, document, or thesis.
Where are you now?
WBT Using JavaScript Alert Buttons
