Tipik bir SCORM kursta, kurs içeriği bir alt çerçeveye (iframe) yüklenirken ana çerçeve içinde API bağlantısı korunur. Iframe içerisindeki içerikler yüklenebilir ve yüklenebilir; iframe içerisindeki içerik, puan ve tamamlama durumu gibi bir dersin ömrü boyunca yapmak istediğiniz önemli SCORM çağrılarını içerme eğiliminde olacaktır, ancak bilgileri ana kareye taşıyan LMS ile iletişim.
İşte SCORM 1.2 kullanılarak hızlı bir örnek var
index.html (üst çerçeve)
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Course Title</title>
<style>
/* Use CSS to make the iframe fill the parent frame,
giving impression no frames are being used */
body { padding: 0; margin: 0; overflow: hidden; }
iframe { position: absolute; top: 0; right: 0; bottom: 0; left: 0; overflow: auto; }
</style>
</head>
<body>
<iframe src="" id="course-content" frameborder="0"></iframe>
<script>
//Place initialization routine here.
//Connect to SCORM API, run API.LMSInitialize()
var SCORM_API = window.API; //shortcut reference
function setScore(score){
SCORM_API.LMSSetValue("cmi.core.score.raw", score);
}
function setStatus(status){
SCORM_API.LMSSetValue("cmi.core.lesson_status", status);
}
function endCourse(){
SCORM_API.LMSCommit();//Save, just in case
SCORM_API.LMSFinish();//Close API connection
}
SCORM_API.LMSInitialize();
//Load child frame once SCORM_API is ready
document.getElementById("course-content").setAttribute("src", "content.html");
</script>
</body>
</html>
content.html (çocuk çerçevesi (bir LMS test değil, barebone, fleshed gerekecektir))
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Course Content</title>
</head>
<body>
<p>This is the content of the course. Add scripts to make it do something.</p>
<script>
//Place course functionality here, such as setting a bookmark or score.
//'parent' is the parent frame.
//This is a very arbitrary example of what you can do when a course loads
parent.setScore("100");
parent.setStatus("completed");
parent.endCourse();
</script>
</body>
</html>
genellikle ağır kaldırma bazı işlemek için bir SCORM sarmalayıcı kullanmak isteyeceğinizi ve kod sürdürülebilirliğini ve ce iyileştirmek için bir abstraction layer kullanmak isteyeceğinizi Üst çerçevedeki SCORM komutlarınızı çoğaltın. endCourse()
işlevi, bir soyutlama katmanının çok basit bir örneğidir. API'yi doğrudan çocuk çerçevesine çağırmak yerine, bir işlevi çağırırsınız.