473,587 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SCORM LMS API and Javascript

Hello, I have an applet named API and the code that calls it, in a JSP, is :
<applet code="API" archive="lms.ja r" height="0" width="0" >If you see this
message, your browser cannot run Applet LMS.</applet>

The page has also a JavaScript code that looks as:

function findAPI(win)
{
while ((win.API == null) && (win.parent != null) && (win.parent != win))
{
findAPITries++;
// Note: 7 is an arbitrary number, but should be more than sufficient
if (findAPITries 7)
{
alert("Error finding API -- too deeply nested.");
return null;
}

win = win.parent;

}
return win.API;
}

From Java console I see the applet loaded and inited, but the function above
returns "null". It seems that the applet is loaded but the Javascript cannot
see it.
Can you help me?
The environment is: Tomcat, Java, Eclipse, Windows/Linux.

Thank you.
Nov 26 '06 #1
4 9582
Birbo wrote:
Hello, I have an applet named API and the code that calls it, in a JSP, is :
<applet code="API" archive="lms.ja r" height="0" width="0" >
It seems that the applet is loaded but the Javascript cannot
see it.
If you have just one applet then you can access
document.applet s[0]
in JavaScript to access the applet.
Or give the applet a name attribute e.g.
<applet name="appletNam e" ...>
and then you can access
document.applet s.appletName
You can also give the applet an id attribute
<applet id="appletId" ...>
and then you can use
document.getEle mentById('apple tId')
in script to access the applet.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 26 '06 #2

"Martin Honnen" <ma*******@yaho o.deha scritto nel messaggio
news:45******** *************** @newsspool4.arc or-online.net...
>>It seems that the applet is loaded but the Javascript cannot
see it.

If you have just one applet then you can access
document.applet s[0]
in JavaScript to access the applet.
Or give the applet a name attribute e.g.
<applet name="appletNam e" ...>
and then you can access
document.applet s.appletName
You can also give the applet an id attribute
<applet id="appletId" ...>
and then you can use
document.getEle mentById('apple tId')
in script to access the applet.
Thank you for your answer. The problem is that the javascript is not mine,
it is part of a package I have only to run into my platform. I have to write
the applet that exposes the functions called by the javascript. Furthermore,
the same packet works fine on other platforms (most of them are in php).
Inspecting the source:

function findAPI(win)
{
while ((win.API == null) && (win.parent != null) && (win.parent != win))
{
...
}
return win.API;
}

I guess it expects an object name "API" belonging to win. Maybe I am missing
some init function as:

var API = document.getEle mentById('apple tId');

Tomorrow I'll try this way.
Nov 26 '06 #3
Birbo wrote:
Hello, I have an applet named API and the code that calls it, in a JSP, is :
<applet code="API" archive="lms.ja r" height="0" width="0" >If you see this
message, your browser cannot run Applet LMS.</applet>

The page has also a JavaScript code that looks as:

function findAPI(win)
{
while ((win.API == null) && (win.parent != null) && (win.parent != win))
{
findAPITries++;
// Note: 7 is an arbitrary number, but should be more than sufficient
if (findAPITries 7)
{
alert("Error finding API -- too deeply nested.");
return null;
}

win = win.parent;

}
return win.API;
}

From Java console I see the applet loaded and inited, but the function above
returns "null". It seems that the applet is loaded but the Javascript cannot
see it.
Can you help me?
The environment is: Tomcat, Java, Eclipse, Windows/Linux.
That code is for SCORM 1.2 and it looks like the sample code from
adl.org which has "errors" in it.

Show the rest of the javascript.

Andrew Poulos
Nov 26 '06 #4

"Andrew Poulos" <ap*****@hotmai l.comha scritto nel messaggio
news:45******** *************** @per-qv1-newsreader-01.iinet.net.au ...
>
That code is for SCORM 1.2 and it looks like the sample code from adl.org
which has "errors" in it.
Thanks, I solved the problem using the following code:

<applet code="API" archive="${init Param.projectPa th }/assets/lms/lms.jar"
id="APIApplet" codebase="${ini tParam.projectP ath }/assets/lms"
MAYSCRIPT="true " height="0" width="0" >
If you see this message, your browser cannot run Applet LMS.</applet>

<script type="text/javascript">
window.onload = function()
{
API = this.document.A PIApplet;
}
</script>
Nov 27 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2123
by: ezura81 | last post by:
I have a prob with javascript that unite to flash. I want to get and send value from/to flash. then i need to know if anybody know about cmi.core.score.raw....then i need to know how we want to calculate their page progress that have been visited by user...using javascript...Do anyone know?? Please answer if anybody know...Thanx...
1
2055
mageswar005
by: mageswar005 | last post by:
hi, Now i am doing e-learning management system Project.Now we use scorm1.2 version, but we need to implement Scorm 2004 version for my application, any one help me how to implement Scorm 2004. Thanks With regards, Mageswaran.M
0
7920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7849
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7973
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5718
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5394
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3844
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.