Manual

19
SECTION 3. EVENTS
1) On a card data change event:
In the event of card data change, the applet will return the card-swipe data by calling the Java script provided in
the para name of RunJSOnCardDataChange. The Java script to be called must have one parameter to receive
the card-swipe data. For example, the applet will return the card-swipe data by calling the “SetCardData” Java
script in the following example. The “SetCardData” function prototype is as follows:
function SetCardData(cardSwipedData)
{ //Do something on a card data change event. }
<script language="JavaScript">
if(window.navigator.appName.toLowerCase().indexOf("netscape")!=-1)
{ // set object for Netscape:
document.getElementById('dvObjectHolder').innerHTML ="<applet
type=\"application/x-java-applet;version=1.5\"" +
"codebase =\".\"" +
"archive = \"JMTBluetoothReader.jar\"" +
"code=\"JMTBTCardReader.class\"" +
"name=\"MTRS232MSR\"" +
"scriptable=\"true\"" +
"style=\"visibility:hidden;\"" +
"mayscript=\"mayscript\"" +
"pluginspage=\"http://java.com/en/download/index.jsp\"" + ">" +
"<param name=\"cache_option\" value=\"No\">" +
"<param name=\"classloader_cache\" value=\"true\">" +
"<param name= \"ReportJavaPluginVersion\" value=\"no\">" +
"<param name= \"RunJSOnCardDataChange\" value=\"SetCardData\">" +
"</applet>";
}
else if(window.navigator.appName.toLowerCase().indexOf('internet
Explorer')!=-1){ //set object for IE
document.getElementById('dvObjectHolder').innerHTML = "<object
type=\"application/x-java-applet;version=1.5\"" +
"codebase =\".\"" +
"archive = \"JMTBluetoothReader.jar\"" +
"code=\"JMTBTCardReader.class\"" +
"name=\"MTRS232MSR\"" +
"height=\"0\" width=\"0\" >" +
"<param name=\"mayscript\" value=\"true\">" +
"<param name=\"classloader_cache\" value=\"true\">" +
"<param name=\"cache_option\" value=\"No\">" +
"<param name= \"ReportJavaPluginVersion\" value=\"no\">" +
"<param name= \"RunJSOnCardDataChange\" value=\"SetCardData\">" +
" </object>"
}
</script>
2) If the param name “ReportJavaPluginVersion” is set to “yes”, the Java script
ReportJavaPluginVersion” should be available to be called and will have
the following function prototype:
function ReportJavaPluginVersion(ver)
{//Do something }